path: root/ui
diff options
authorMikael Kanstrup <mikael.kanstrup@gmail.com>2017-09-25 23:18:31 +0200
committerMichael Mann <mmann78@netscape.net>2017-09-25 23:37:56 +0000
commita8a3903e55af23bdce550a95ffe14a398fd1204c (patch)
treeba91f9aae0f2970d4834f97dde6d5c558bdea2db /ui
parente2d43e7d4b352206bac6bdd42f2c8f04d1e126b2 (diff)
Qt: Free MainWindow at shutdown
MainWindow is allocated on heap on startup but not freed on shutdown. Free the object at shutdown mainly to silent Valgrind. When at it also fix two problems with the MainWindow destructor: - Deleting main_ui_ triggers a currentChanged signal which in turn calls mainStackChanged that references the freed main_ui_ object. Prevent use after free error by disconnecting from the signal before freeing. - Explicitly free file_set_dialog_ as no rparent perform the cleanup. Bug: 14071 Change-Id: I9c1fbef04cf68bfffffea57ef298f4896d6583f9 Reviewed-on: https://code.wireshark.org/review/23739 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui')
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 1d1e9eb24b..e7fcc99032 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -736,6 +736,16 @@ MainWindow::MainWindow(QWidget *parent) :
+ disconnect(main_ui_->mainStack, 0, 0, 0);
+#ifndef Q_OS_MAC
+ // file_set_dialog_ is a subclass of GeometryStateDialog.
+ // For reasons described in geometry_state_dialog.h no parent is set when
+ // instantiating the dialog and as a result the object is not automatically
+ // freed by its parent. Free it here explicitly to avoid leak and numerous
+ // Valgrind complaints.
+ delete file_set_dialog_;
delete main_ui_;