mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 06:49:05 +02:00
cleanup
This commit is contained in:
parent
2eb3fdb1ec
commit
cc7214fca3
2 changed files with 14 additions and 19 deletions
|
@ -2836,20 +2836,17 @@ void Application::cleanupBeforeQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Quit 1";
|
|
||||||
// remove avatars from physics engine
|
// remove avatars from physics engine
|
||||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||||
avatarManager->clearOtherAvatars();
|
avatarManager->clearOtherAvatars();
|
||||||
auto myCharacterController = getMyAvatar()->getCharacterController();
|
auto myCharacterController = getMyAvatar()->getCharacterController();
|
||||||
myCharacterController->clearDetailedMotionStates();
|
myCharacterController->clearDetailedMotionStates();
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Quit 2";
|
|
||||||
|
|
||||||
PhysicsEngine::Transaction transaction;
|
PhysicsEngine::Transaction transaction;
|
||||||
avatarManager->buildPhysicsTransaction(transaction);
|
avatarManager->buildPhysicsTransaction(transaction);
|
||||||
_physicsEngine->processTransaction(transaction);
|
_physicsEngine->processTransaction(transaction);
|
||||||
avatarManager->handleProcessedPhysicsTransaction(transaction);
|
avatarManager->handleProcessedPhysicsTransaction(transaction);
|
||||||
avatarManager->deleteAllAvatars();
|
avatarManager->deleteAllAvatars();
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Quit 3";
|
|
||||||
|
|
||||||
_physicsEngine->setCharacterController(nullptr);
|
_physicsEngine->setCharacterController(nullptr);
|
||||||
|
|
||||||
|
@ -2860,12 +2857,9 @@ Application::~Application() {
|
||||||
// shutdown graphics engine
|
// shutdown graphics engine
|
||||||
_graphicsEngine.shutdown();
|
_graphicsEngine.shutdown();
|
||||||
|
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Quit 4";
|
|
||||||
_gameWorkload.shutdown();
|
_gameWorkload.shutdown();
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Quit 5";
|
|
||||||
|
|
||||||
DependencyManager::destroy<Preferences>();
|
DependencyManager::destroy<Preferences>();
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Quit 6";
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
DependencyManager::destroy<MacHelper>();
|
DependencyManager::destroy<MacHelper>();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,32 +11,34 @@
|
||||||
|
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
#include "MacHelper.h"
|
#include "MacHelper.h"
|
||||||
|
#include <NodeList.h>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
|
||||||
#include <IOKit/IOMessage.h>
|
#include <IOKit/IOMessage.h>
|
||||||
|
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
io_connect_t root_port;
|
|
||||||
IONotificationPortRef notifyPortRef;
|
|
||||||
io_object_t notifierObject;
|
|
||||||
void* refCon;
|
|
||||||
|
|
||||||
void sleepHandler(void* refCon, io_service_t service, natural_t messageType, void* messageArgument) {
|
// These type definitions come from IOKit, which includes a definition of Duration that conflicts with ours.
|
||||||
qCInfo(interfaceapp) << "HRS FIXME sleepHandler.";
|
// So... we include these definitions here rather than in the .h, as the .h is included in Application.cpp which
|
||||||
|
// uses Duration.
|
||||||
|
static io_connect_t root_port;
|
||||||
|
static IONotificationPortRef notifyPortRef;
|
||||||
|
static io_object_t notifierObject;
|
||||||
|
static void* refCon;
|
||||||
|
|
||||||
|
static void sleepHandler(void* refCon, io_service_t service, natural_t messageType, void* messageArgument) {
|
||||||
if (messageType == kIOMessageSystemHasPoweredOn) {
|
if (messageType == kIOMessageSystemHasPoweredOn) {
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Waking up from sleep or hybernation.";
|
qCInfo(interfaceapp) << "Waking up from sleep or hybernation.";
|
||||||
|
QMetaObject::invokeMethod(DependencyManager::get<NodeList>().data(), "noteAwakening", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MacHelper::MacHelper() {
|
MacHelper::MacHelper() {
|
||||||
qCInfo(interfaceapp) << "HRS FIXME Start MacHelper.";
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
root_port = IORegisterForSystemPower(refCon, ¬ifyPortRef, sleepHandler, ¬ifierObject);
|
root_port = IORegisterForSystemPower(refCon, ¬ifyPortRef, sleepHandler, ¬ifierObject);
|
||||||
if (root_port == 0) {
|
if (root_port == 0) {
|
||||||
qCWarning(interfaceapp) << "IORegisterForSystemPower failed";
|
qCWarning(interfaceapp) << "IORegisterForSystemPower failed";
|
||||||
} else {
|
return;
|
||||||
qCDebug(interfaceapp) << "HRS FIXME IORegisterForSystemPower OK";
|
|
||||||
}
|
}
|
||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(),
|
CFRunLoopAddSource(CFRunLoopGetCurrent(),
|
||||||
IONotificationPortGetRunLoopSource(notifyPortRef),
|
IONotificationPortGetRunLoopSource(notifyPortRef),
|
||||||
|
@ -45,7 +47,6 @@ MacHelper::MacHelper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MacHelper::~MacHelper() {
|
MacHelper::~MacHelper() {
|
||||||
qCInfo(interfaceapp) << "HRS FIXME End MacHelper.";
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
|
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
|
||||||
IONotificationPortGetRunLoopSource(notifyPortRef),
|
IONotificationPortGetRunLoopSource(notifyPortRef),
|
||||||
|
|
Loading…
Reference in a new issue