From b22123211776ed6aac994430f40ff7ac7b49b100 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 20 Apr 2016 10:31:26 -0700 Subject: [PATCH] Windows-only version, without changing assignment-client/domain-server classes. --- interface/src/Application.cpp | 12 ++++++------ libraries/shared/src/ShutdownEventListener.cpp | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ded414ceab..fff65a6955 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -366,6 +366,12 @@ public: return true; } } + + if (message->message == WM_CLOSE) { + // tell our registered application to quit + QMetaObject::invokeMethod(qApp, "quit"); + return true; // Don't zombify the application by OS-exitting. Let the application quit in the normal quit-signal way. + } } return false; } @@ -718,12 +724,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle); connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress); - // setup a shutdown event listener to handle SIGTERM or WM_CLOSE for us -#ifdef _WIN32 - installNativeEventFilter(&ShutdownEventListener::getInstance()); -#else - ShutdownEventListener::getInstance(); -#endif // Save avatar location immediately after a teleport. connect(getMyAvatar(), &MyAvatar::positionGoneTo, diff --git a/libraries/shared/src/ShutdownEventListener.cpp b/libraries/shared/src/ShutdownEventListener.cpp index fa2209f9b7..e640126b7b 100644 --- a/libraries/shared/src/ShutdownEventListener.cpp +++ b/libraries/shared/src/ShutdownEventListener.cpp @@ -47,7 +47,6 @@ bool ShutdownEventListener::nativeEventFilter(const QByteArray &eventType, void* if (message->message == WM_CLOSE) { // tell our registered application to quit QMetaObject::invokeMethod(qApp, "quit"); - return true; // Don't zombify the application by OS-exitting. Let the application quit in the normal quit-signal way. } } #endif