summaryrefslogtreecommitdiffstats
path: root/qt-gui.cpp
diff options
context:
space:
mode:
authorGravatar Thiago Macieira <thiago@macieira.org>2013-09-18 10:27:24 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-18 12:02:42 -0500
commit0afe576a507ab4c20200399ea173c2571bd71d68 (patch)
tree4e210c4c14c9ef111f34fabb0ed6beba8d3baff3 /qt-gui.cpp
parent7d9c1e9ee4e4e251f3a3b5e5901818fb5aaa340e (diff)
downloadsubsurface-0afe576a507ab4c20200399ea173c2571bd71d68.tar.gz
Destroy the main window before exiting the application
This ensures all widgets inside the window get destroyed too. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r--qt-gui.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 7414ad426..f76beed12 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -66,6 +66,7 @@ QString Translator::translate(const char *context, const char *sourceText,
}
static QApplication *application = NULL;
+static MainWindow *window = NULL;
int error_count;
const char *existing_filename;
@@ -117,7 +118,7 @@ void init_ui(int *argcp, char ***argvp)
s.endGroup();
application->installTranslator(new Translator(application));
- MainWindow *window = new MainWindow();
+ window = new MainWindow();
window->show();
if (existing_filename && existing_filename[0] != '\0')
window->setTitle(MWTF_FILENAME);
@@ -134,6 +135,7 @@ void run_ui(void)
void exit_ui(void)
{
+ delete window;
delete application;
if (existing_filename)
free((void *)existing_filename);