mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Use our ShutdownEventListener utility in Interface, and absorb quit
signal when we handle it.
This commit is contained in:
parent
cbb76013c4
commit
a7d2373f3e
2 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue