mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: make MainWindow a "global object"
Thus, we don't have to delete it explicitly on exit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
16aa761e86
commit
ee9344eccf
2 changed files with 2 additions and 5 deletions
|
@ -111,7 +111,7 @@ extern "C" void showErrorFromC(char *buf)
|
||||||
emit MainWindow::instance()->showError(error);
|
emit MainWindow::instance()->showError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow() : QMainWindow(),
|
MainWindow::MainWindow() :
|
||||||
appState((ApplicationState)-1), // Invalid state
|
appState((ApplicationState)-1), // Invalid state
|
||||||
actionNextDive(nullptr),
|
actionNextDive(nullptr),
|
||||||
actionPreviousDive(nullptr),
|
actionPreviousDive(nullptr),
|
||||||
|
|
|
@ -58,16 +58,13 @@ void init_ui()
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
register_qml_types(NULL);
|
register_qml_types(NULL);
|
||||||
|
|
||||||
MainWindow *window = new MainWindow();
|
MainWindow *window = make_global<MainWindow>();
|
||||||
window->setTitle();
|
window->setTitle();
|
||||||
#endif // SUBSURFACE_MOBILE
|
#endif // SUBSURFACE_MOBILE
|
||||||
}
|
}
|
||||||
|
|
||||||
void exit_ui()
|
void exit_ui()
|
||||||
{
|
{
|
||||||
#ifndef SUBSURFACE_MOBILE
|
|
||||||
delete MainWindow::instance();
|
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
free_globals();
|
free_globals();
|
||||||
free((void *)existing_filename);
|
free((void *)existing_filename);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue