summaryrefslogtreecommitdiffhomepage
path: root/gui/main.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-16 17:39:15 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-16 17:54:12 +0200
commitaf8d6f769c26d4d260d6fc430165b51aebbd0733 (patch)
tree2129d44b18bc919b339d7bfd9de9da6b3c921669 /gui/main.cpp
parenta781170550b4354e0f5551e0b20560d84e4108ce (diff)
gui/main-window: exit program when config not writable
Note, it opens the config in read-write mode to check if it's writable. This might present a race condition when config is saved. However, we're expecting all config saving to be done in the user interface thread. Add a check for it however.
Diffstat (limited to 'gui/main.cpp')
-rw-r--r--gui/main.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/gui/main.cpp b/gui/main.cpp
index c3e3999a..47999212 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -137,34 +137,36 @@ main(int argc, char** argv)
add_win32_path();
#endif
- {
+ do
+ {
mem<MainWindow> w = std::make_shared<MainWindow>();
+ if (!w->isEnabled())
+ break;
+
if (!w->is_tray_enabled())
{
- w->setHidden(false);
+ w->setVisible(true);
w->show();
}
else
- {
w->setVisible(false);
- w->setHidden(true);
- }
app.setQuitOnLastWindowClosed(false);
app.exec();
qDebug() << "exit: window";
}
+ while (false);
- qDebug() << "exit: main()";
-
- // msvc crashes again in some destructor
+ // msvc crashes in some destructor
#if defined(_MSC_VER)
qDebug() << "exit: terminating";
TerminateProcess(GetCurrentProcess(), 0);
#endif
+ qDebug() << "exit: main()";
+
return 0;
}