From b22f1da59e37ff4ba871fb2d6c72ee3ec87b4c5b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 30 Nov 2013 09:18:04 -0800 Subject: Fix all leak-at-exit from singletons in Subsurface Subsurface creates a lot of singleton instances on demand, but nothing ever deleted them. Since they are singletons, these memory allocations are technically not leaks. However, they clutter the output in valgrind and other memory analysers, hiding the real issues. The solution is to delete these items at exit. For the models and for gettextFromC, the solution is to use a QScopedPointer, which will delete its payload when it gets destroyed. For the dialogs and other widgets, we can't do that: they need to be deleted before QApplication exits, so we just set the parent in all of them to the main window. Signed-off-by: Thiago Macieira Signed-off-by: Dirk Hohndel --- qt-ui/divecomputermanagementdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-ui/divecomputermanagementdialog.cpp') diff --git a/qt-ui/divecomputermanagementdialog.cpp b/qt-ui/divecomputermanagementdialog.cpp index 883c8e9a7..af27e914f 100644 --- a/qt-ui/divecomputermanagementdialog.cpp +++ b/qt-ui/divecomputermanagementdialog.cpp @@ -23,7 +23,7 @@ void DiveComputerManagementDialog::init() DiveComputerManagementDialog* DiveComputerManagementDialog::instance() { - static DiveComputerManagementDialog *self = new DiveComputerManagementDialog(); + static DiveComputerManagementDialog *self = new DiveComputerManagementDialog(mainWindow()); self->setAttribute(Qt::WA_QuitOnClose, false); return self; } -- cgit v1.2.3-70-g09d2