diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-04-13 10:54:06 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-14 03:16:48 +1200 |
commit | 88ed5bf05054a3a4b2313cec81e6756279e6bdb1 (patch) | |
tree | 6cb2fe00c1c393645e7aac99387f9f807190d376 /desktop-widgets/mainwindow.h | |
parent | 17e7cc048feee5f5b46a4ea3932e2e6500ec5e58 (diff) | |
download | subsurface-88ed5bf05054a3a4b2313cec81e6756279e6bdb1.tar.gz |
Desktop: destroy maintab before destructing mainwindow
Apparently, in some Qt-versions the destructor of the base class
calls hide on child-objects (according to Qt's object hierarchy).
This is obviously called after the derived class has been destructed.
In a concrete case, the base class of the destructed MainWindow
would hide the TabDiveSite object. That would reset the filtering
if a dive site was selected, which would indirectly access the
MainWindow, which is already partially destroyed.
Therefore, destroy the MainTab before destroying the MainWindow.
Do this by keeping it as a std::unique_ptr subobject. Thus, it
will be destroyed before the MainWindow and remove itself from
Qt's object hierarchy.
Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.h')
-rw-r--r-- | desktop-widgets/mainwindow.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index efac8610e..252a95b98 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -13,6 +13,7 @@ #include <QUrl> #include <QUuid> #include <QProgressDialog> +#include <memory> #include "ui_mainwindow.h" #include "ui_plannerDetails.h" @@ -84,7 +85,7 @@ public: void exitEditState(); void editDiveSite(dive_site *ds); - MainTab *mainTab; + std::unique_ptr<MainTab> mainTab; PlannerDetails *plannerDetails; PlannerSettingsWidget *divePlannerSettingsWidget; ProfileWidget2 *graphics; |