mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
first cut at properly shutting down timers while shutting down scripts
This commit is contained in:
parent
1efa7b28b0
commit
7e2d355b56
2 changed files with 15 additions and 0 deletions
|
@ -535,6 +535,9 @@ void ScriptEngine::run() {
|
||||||
}
|
}
|
||||||
lastUpdate = now;
|
lastUpdate = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopAllTimers(); // make sure all our timers are stopped if the script is ending
|
||||||
|
|
||||||
emit scriptEnding();
|
emit scriptEnding();
|
||||||
|
|
||||||
// kill the avatar identity timer
|
// kill the avatar identity timer
|
||||||
|
@ -564,6 +567,17 @@ void ScriptEngine::run() {
|
||||||
emit doneRunning();
|
emit doneRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: This is private because it must be called on the same thread that created the timers, which is why
|
||||||
|
// we want to only call it in our own run "shutdown" processing.
|
||||||
|
void ScriptEngine::stopAllTimers() {
|
||||||
|
QMutableHashIterator<QTimer*, QScriptValue> i(_timerFunctionMap);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
QTimer* timer = i.key();
|
||||||
|
stopTimer(timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptEngine::stop() {
|
void ScriptEngine::stop() {
|
||||||
_isFinished = true;
|
_isFinished = true;
|
||||||
emit runningStateChanged();
|
emit runningStateChanged();
|
||||||
|
|
|
@ -141,6 +141,7 @@ protected:
|
||||||
int _numAvatarSoundSentBytes;
|
int _numAvatarSoundSentBytes;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void stopAllTimers();
|
||||||
void sendAvatarIdentityPacket();
|
void sendAvatarIdentityPacket();
|
||||||
void sendAvatarBillboardPacket();
|
void sendAvatarBillboardPacket();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue