From d659ac573a963b2494675ce5b2264b3e53364f4d Mon Sep 17 00:00:00 2001 From: Kai Ludwig Date: Wed, 18 Feb 2015 19:53:45 +0100 Subject: [PATCH 1/3] now all application timers should get stopped correctly on exit --- interface/src/Application.cpp | 45 ++++++++++++++++++++++++++--------- interface/src/Application.h | 2 +- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d1558c3799..855eb5e1ba 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -139,6 +139,12 @@ static unsigned STARFIELD_SEED = 1; const qint64 MAXIMUM_CACHE_SIZE = 10737418240; // 10GB +static QTimer* locationUpdateTimer = NULL; +static QTimer* balanceUpdateTimer = NULL; +static QTimer* silentNodeTimer = NULL; +static QTimer* identityPacketTimer = NULL; +static QTimer* billboardPacketTimer = NULL; +static QTimer* checkFPStimer = NULL; static QTimer* idleTimer = NULL; const QString CHECK_VERSION_URL = "https://highfidelity.io/latestVersion.xml"; @@ -361,7 +367,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : // update our location every 5 seconds in the data-server, assuming that we are authenticated with one const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000; - QTimer* locationUpdateTimer = new QTimer(this); + locationUpdateTimer = new QTimer(this); connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer); locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); @@ -377,7 +383,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : const qint64 BALANCE_UPDATE_INTERVAL_MSECS = 5 * 1000; - QTimer* balanceUpdateTimer = new QTimer(this); + balanceUpdateTimer = new QTimer(this); connect(balanceUpdateTimer, &QTimer::timeout, &accountManager, &AccountManager::updateBalance); balanceUpdateTimer->start(BALANCE_UPDATE_INTERVAL_MSECS); @@ -416,18 +422,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); // move the silentNodeTimer to the _nodeThread - QTimer* silentNodeTimer = new QTimer(); + silentNodeTimer = new QTimer(); connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes())); silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS); silentNodeTimer->moveToThread(_nodeThread); // send the identity packet for our avatar each second to our avatar mixer - QTimer* identityPacketTimer = new QTimer(); + identityPacketTimer = new QTimer(); connect(identityPacketTimer, &QTimer::timeout, _myAvatar, &MyAvatar::sendIdentityPacket); identityPacketTimer->start(AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS); // send the billboard packet for our avatar every few seconds - QTimer* billboardPacketTimer = new QTimer(); + billboardPacketTimer = new QTimer(); connect(billboardPacketTimer, &QTimer::timeout, _myAvatar, &MyAvatar::sendBillboardPacket); billboardPacketTimer->start(AVATAR_BILLBOARD_PACKET_SEND_INTERVAL_MSECS); @@ -526,11 +532,28 @@ void Application::aboutToQuit() { } void Application::cleanupBeforeQuit() { - // make sure we don't call the idle timer any more + // first stop all timers directly or by invokeMethod + // depending on what thread they run in + locationUpdateTimer->stop(); + balanceUpdateTimer->stop(); + QMetaObject::invokeMethod(silentNodeTimer, "stop", Qt::BlockingQueuedConnection); + identityPacketTimer->stop(); + billboardPacketTimer->stop(); + checkFPStimer->stop(); + idleTimer->stop(); + QMetaObject::invokeMethod(&_settingsTimer, "stop", Qt::BlockingQueuedConnection); + + // and then delete those that got created by "new" + delete locationUpdateTimer; + delete balanceUpdateTimer; + delete silentNodeTimer; + delete identityPacketTimer; + delete billboardPacketTimer; + delete checkFPStimer; delete idleTimer; + // no need to delete _settingsTimer here as it is no pointer // save state - QMetaObject::invokeMethod(&_settingsTimer, "stop", Qt::BlockingQueuedConnection); _settingsThread.quit(); saveSettings(); _window->saveGeometry(); @@ -629,9 +652,9 @@ void Application::initializeGL() { _entityEditSender.initialize(_enableProcessOctreeThread); // call our timer function every second - QTimer* timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(timer())); - timer->start(1000); + checkFPStimer = new QTimer(this); + connect(checkFPStimer, SIGNAL(timeout()), SLOT(checkFPS())); + checkFPStimer->start(1000); // call our idle function whenever we can idleTimer = new QTimer(this); @@ -1427,7 +1450,7 @@ void Application::sendPingPackets() { } // Every second, check the frame rates and other stuff -void Application::timer() { +void Application::checkFPS() { if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) { sendPingPackets(); } diff --git a/interface/src/Application.h b/interface/src/Application.h index da29920ef9..f5c5397f6e 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -368,7 +368,7 @@ public slots: private slots: void clearDomainOctreeDetails(); - void timer(); + void checkFPS(); void idle(); void aboutToQuit(); From a947cda0b224b97a0b9029c3cfbc2dae965c7336 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Feb 2015 13:02:37 -0800 Subject: [PATCH 2/3] Update SVG URL to Amazon S3 --- examples/progress.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/progress.js b/examples/progress.js index 57a1fd1a07..55ea15f218 100644 --- a/examples/progress.js +++ b/examples/progress.js @@ -32,8 +32,7 @@ BAR_URL = "http://hifi-public.s3.amazonaws.com/images/progress-bar.svg", BACKGROUND_WIDTH = 540, BACKGROUND_HEIGHT = 90, - BACKGROUND_URL = "http://ctrlaltstudio.com/hifi/progress-bar-background.svg", - //BACKGROUND_URL = "http://hifi-public.s3.amazonaws.com/images/progress-bar-background.svg", + BACKGROUND_URL = "http://hifi-public.s3.amazonaws.com/images/progress-bar-background.svg", isOnHMD = false, windowWidth = 0, windowHeight = 0, From cf9d92abc0db946f168b27d9c5e2305f209d16c8 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 18 Feb 2015 15:48:12 -0800 Subject: [PATCH 3/3] fix EntityServer crash for zero view aspectRatio --- libraries/octree/src/OctreeQuery.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/OctreeQuery.h b/libraries/octree/src/OctreeQuery.h index 66abe53931..1fefabdf68 100644 --- a/libraries/octree/src/OctreeQuery.h +++ b/libraries/octree/src/OctreeQuery.h @@ -95,7 +95,7 @@ protected: glm::vec3 _cameraPosition = glm::vec3(0.0f); glm::quat _cameraOrientation = glm::quat(); float _cameraFov = 0.0f; - float _cameraAspectRatio = 0.0f; + float _cameraAspectRatio = 1.0f; float _cameraNearClip = 0.0f; float _cameraFarClip = 0.0f; glm::vec3 _cameraEyeOffsetPosition = glm::vec3(0.0f);