diff options
-rw-r--r-- | cmake/msvc.cmake | 2 | ||||
-rw-r--r-- | gui/init.cpp | 6 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.cpp | 2 | ||||
-rw-r--r-- | proto-wine/CMakeLists.txt | 2 | ||||
-rw-r--r-- | variant/default/main-window.cpp | 19 | ||||
-rw-r--r-- | variant/default/main-window.hpp | 6 | ||||
-rw-r--r-- | x-plane-plugin/CMakeLists.txt | 2 |
7 files changed, 27 insertions, 12 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index df04449a..1a606989 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -58,7 +58,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack") set(CMAKE_RC_FLAGS "/nologo /DWIN32") endif() -set(base-cflags "-MT -Zi -W4 -Zf -Zo -bigobj -cgthreads1 ${warns_}") +set(base-cflags "-MT -Zi -W4 -Zf -Zo -bigobj -cgthreads1 -diagnostics:caret ${warns_}") #set(base-cflags "${base-cflags} -d2cgsummary") set(_CFLAGS "${base-cflags}") diff --git a/gui/init.cpp b/gui/init.cpp index a3932047..4609d535 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -190,7 +190,7 @@ static int run_window(std::unique_ptr<QWidget> main_window) { if (!main_window->isEnabled()) { - qDebug() << "exit before window created"; + qDebug() << "opentrack: exit before window created"; return 2; } @@ -228,7 +228,9 @@ int otr_main(int argc, char** argv, std::function<QWidget*()> const& make_main_w qDebug() << "locale:" << forced_locale; } - const bool no_i18n = options::globals::with_global_settings_object([](QSettings& s) { + using namespace options::globals; + + const bool no_i18n = with_global_settings_object([](QSettings& s) { return s.value("disable-translation", false).toBool(); }); diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index 51472092..bd7f0960 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -157,7 +157,7 @@ module_status simconnect::initialize() if (ctx.is_ok()) { SCClientLib.setFileName("SimConnect.dll"); - SCClientLib.setLoadHints(QLibrary::PreventUnloadHint); + SCClientLib.setLoadHints(QLibrary::PreventUnloadHint | QLibrary::ResolveAllSymbolsHint); if (!SCClientLib.load()) return error(tr("dll load failed -- %1").arg(SCClientLib.errorString())); } diff --git a/proto-wine/CMakeLists.txt b/proto-wine/CMakeLists.txt index fe99267d..86559435 100644 --- a/proto-wine/CMakeLists.txt +++ b/proto-wine/CMakeLists.txt @@ -10,7 +10,7 @@ if(NOT WIN32) set(my-rt) endif() file(GLOB wine-deps "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx") - install(FILES ${wine-deps} DESTINATION "${opentrack-doc-src-pfx}/proto-wine") + #install(FILES ${wine-deps} DESTINATION "${opentrack-doc-src-pfx}/proto-wine") add_custom_command( OUTPUT opentrack-wrapper-wine.exe.so DEPENDS ${wine-deps} 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); } diff --git a/variant/default/main-window.hpp b/variant/default/main-window.hpp index 3c55be9e..55fca177 100644 --- a/variant/default/main-window.hpp +++ b/variant/default/main-window.hpp @@ -69,15 +69,17 @@ class main_window final : public QMainWindow, private State menu_action_options { &tray_menu }, menu_action_mappings { &tray_menu }; + bool exiting_already { false }; + using dylib_ptr = Modules::dylib_ptr; using dylib_list = Modules::dylib_list; - static std::tuple<dylib_ptr, int> module_by_name(const QString& name, Modules::dylib_list& list); - dylib_ptr current_tracker(); dylib_ptr current_protocol(); dylib_ptr current_filter(); + static std::tuple<dylib_ptr, int> module_by_name(const QString& name, Modules::dylib_list& list); + void update_button_state(bool running, bool inertialp); void display_pose(const double* mapped, const double* raw); void set_title(const QString& game_title = QString()); diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index 32ec16e2..23881ca3 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -4,7 +4,7 @@ if(LINUX OR APPLE) if(SDK_XPLANE) otr_module(xplane-plugin NO-QT) # probably librt already included - install(FILES ${opentrack-xplane-plugin-c} DESTINATION "${opentrack-doc-src-pfx}/opentrack-xplane-plugin") + #install(FILES ${opentrack-xplane-plugin-c} DESTINATION "${opentrack-doc-src-pfx}/opentrack-xplane-plugin") target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders ${SDK_XPLANE}/CHeaders/XPLM) if(APPLE) |