mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge pull request #4310 from talentraspel/20323
CR for Job #20323 - BUG: another crash on exit in interface
This commit is contained in:
commit
21405135f9
2 changed files with 35 additions and 12 deletions
|
@ -140,6 +140,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";
|
||||
|
@ -362,7 +368,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);
|
||||
|
||||
|
@ -378,7 +384,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);
|
||||
|
||||
|
@ -417,18 +423,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);
|
||||
|
||||
|
@ -527,11 +533,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();
|
||||
|
@ -630,9 +653,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);
|
||||
|
@ -1428,7 +1451,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();
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ public slots:
|
|||
|
||||
private slots:
|
||||
void clearDomainOctreeDetails();
|
||||
void timer();
|
||||
void checkFPS();
|
||||
void idle();
|
||||
void aboutToQuit();
|
||||
|
||||
|
|
Loading…
Reference in a new issue