Use our ShutdownEventListener utility in Interface, and absorb quit

signal when we handle it.
This commit is contained in:
howard-stearns 2016-04-19 16:17:39 -07:00
parent cbb76013c4
commit a7d2373f3e
2 changed files with 8 additions and 0 deletions

View file

@ -91,6 +91,7 @@
#include <ScriptCache.h>
#include <SoundCache.h>
#include <ScriptEngines.h>
#include <ShutdownEventListener.h>
#include <Tooltip.h>
#include <udt/PacketHeaders.h>
#include <UserActivityLogger.h>
@ -717,6 +718,12 @@ 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,

View file

@ -47,6 +47,7 @@ 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