diff --git a/Libraries/LibCore/CObject.h b/Libraries/LibCore/CObject.h index dd036ef666..7a5ce63785 100644 --- a/Libraries/LibCore/CObject.h +++ b/Libraries/LibCore/CObject.h @@ -85,6 +85,12 @@ public: void dispatch_event(CEvent&, CObject* stay_within = nullptr); + void remove_from_parent() + { + if (m_parent) + m_parent->remove_child(*this); + } + protected: explicit CObject(CObject* parent = nullptr, bool is_widget = false);