diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-27 12:52:35 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-27 12:52:35 +0200 |
commit | de08c69d0c66f06bd165e3b6bd63b71ac83db9a9 (patch) | |
tree | 637c6569e5ce292db521e5ece6042418100cc393 /variant/default/main-window.cpp | |
parent | 841d3b28d6bda2fca3275ade618c28627b0565c2 (diff) |
cleanup
Diffstat (limited to 'variant/default/main-window.cpp')
-rw-r--r-- | variant/default/main-window.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index d6df6b8f..6529db11 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -135,11 +135,11 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH) // timers connect(&config_list_timer, &QTimer::timeout, this, [this] { refresh_config_list(); }); - connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(show_pose()), Qt::DirectConnection); + connect(&pose_update_timer, &QTimer::timeout, this, &main_window::show_pose, Qt::DirectConnection); connect(&det_timer, SIGNAL(timeout()), this, SLOT(maybe_start_profile_from_executable())); // ctrl+q exits - connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit())); + connect(&kbd_quit, &QShortcut::activated, this, [this]() { main_window::exit(EXIT_SUCCESS); }, Qt::DirectConnection); // profile menu { @@ -793,11 +793,22 @@ void main_window::show_mapping_window() void main_window::exit(int status) { - QApplication::setQuitOnLastWindowClosed(true); + // don't use std::call_once here, leads to freeze in Microsoft's CRT + // this function never needs reentrancy anyway + + // this is probably harmless, but better safe than sorry + if (exiting_already) + return; + exiting_already = true; + + qDebug() << "opentrack: exiting"; + if (tray) tray->hide(); tray = nullptr; - close(); + + //close(); + QApplication::setQuitOnLastWindowClosed(true); QApplication::exit(status); } |