mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +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;
|
||||
}
|
||||
|
||||
stopAllTimers(); // make sure all our timers are stopped if the script is ending
|
||||
|
||||
emit scriptEnding();
|
||||
|
||||
// kill the avatar identity timer
|
||||
|
@ -564,6 +567,17 @@ void ScriptEngine::run() {
|
|||
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() {
|
||||
_isFinished = true;
|
||||
emit runningStateChanged();
|
||||
|
|
|
@ -141,6 +141,7 @@ protected:
|
|||
int _numAvatarSoundSentBytes;
|
||||
|
||||
private:
|
||||
void stopAllTimers();
|
||||
void sendAvatarIdentityPacket();
|
||||
void sendAvatarBillboardPacket();
|
||||
|
||||
|
|
Loading…
Reference in a new issue