mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +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() {
|
||||
qCInfo(interfaceapp) << "HRS FIXME Quit 1";
|
||||
// remove avatars from physics engine
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
avatarManager->clearOtherAvatars();
|
||||
auto myCharacterController = getMyAvatar()->getCharacterController();
|
||||
myCharacterController->clearDetailedMotionStates();
|
||||
qCInfo(interfaceapp) << "HRS FIXME Quit 2";
|
||||
|
||||
PhysicsEngine::Transaction transaction;
|
||||
avatarManager->buildPhysicsTransaction(transaction);
|
||||
_physicsEngine->processTransaction(transaction);
|
||||
avatarManager->handleProcessedPhysicsTransaction(transaction);
|
||||
avatarManager->deleteAllAvatars();
|
||||
qCInfo(interfaceapp) << "HRS FIXME Quit 3";
|
||||
|
||||
_physicsEngine->setCharacterController(nullptr);
|
||||
|
||||
|
@ -2860,12 +2857,9 @@ Application::~Application() {
|
|||
// shutdown graphics engine
|
||||
_graphicsEngine.shutdown();
|
||||
|
||||
qCInfo(interfaceapp) << "HRS FIXME Quit 4";
|
||||
_gameWorkload.shutdown();
|
||||
qCInfo(interfaceapp) << "HRS FIXME Quit 5";
|
||||
|
||||
DependencyManager::destroy<Preferences>();
|
||||
qCInfo(interfaceapp) << "HRS FIXME Quit 6";
|
||||
#ifdef Q_OS_MAC
|
||||
DependencyManager::destroy<MacHelper>();
|
||||
#endif
|
||||
|
|
|
@ -11,32 +11,34 @@
|
|||
|
||||
#include "InterfaceLogging.h"
|
||||
#include "MacHelper.h"
|
||||
#include <NodeList.h>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||
#include <IOKit/IOMessage.h>
|
||||
|
||||
io_connect_t root_port;
|
||||
IONotificationPortRef notifyPortRef;
|
||||
io_object_t notifierObject;
|
||||
void* refCon;
|
||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||
|
||||
void sleepHandler(void* refCon, io_service_t service, natural_t messageType, void* messageArgument) {
|
||||
qCInfo(interfaceapp) << "HRS FIXME sleepHandler.";
|
||||
// These type definitions come from IOKit, which includes a definition of Duration that conflicts with ours.
|
||||
// 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) {
|
||||
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
|
||||
|
||||
MacHelper::MacHelper() {
|
||||
qCInfo(interfaceapp) << "HRS FIXME Start MacHelper.";
|
||||
#ifdef Q_OS_MAC
|
||||
root_port = IORegisterForSystemPower(refCon, ¬ifyPortRef, sleepHandler, ¬ifierObject);
|
||||
if (root_port == 0) {
|
||||
qCWarning(interfaceapp) << "IORegisterForSystemPower failed";
|
||||
} else {
|
||||
qCDebug(interfaceapp) << "HRS FIXME IORegisterForSystemPower OK";
|
||||
return;
|
||||
}
|
||||
CFRunLoopAddSource(CFRunLoopGetCurrent(),
|
||||
IONotificationPortGetRunLoopSource(notifyPortRef),
|
||||
|
@ -45,7 +47,6 @@ MacHelper::MacHelper() {
|
|||
}
|
||||
|
||||
MacHelper::~MacHelper() {
|
||||
qCInfo(interfaceapp) << "HRS FIXME End MacHelper.";
|
||||
#ifdef Q_OS_MAC
|
||||
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
|
||||
IONotificationPortGetRunLoopSource(notifyPortRef),
|
||||
|
|
Loading…
Reference in a new issue