diff --git a/Ladybird/Qt/Tab.cpp b/Ladybird/Qt/Tab.cpp index 7ae21f96ab2..bc3f7c8535c 100644 --- a/Ladybird/Qt/Tab.cpp +++ b/Ladybird/Qt/Tab.cpp @@ -579,6 +579,10 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St Tab::~Tab() { close_sub_widgets(); + + // Delete the InspectorWidget explicitly to ensure it is deleted before the WebContentView. Otherwise, Qt + // can destroy these objects in any order, which may cause use-after-free in InspectorWidget's destructor. + delete m_inspector_widget; } void Tab::select_dropdown_add_item(QMenu* menu, Web::HTML::SelectItem const& item)