mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
17e7cc048f
commit
88ed5bf050
2 changed files with 9 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue