mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge pull request #4715 from jherico/audio_crash
Attempting to resolve possible crash case for scripts playing sounds
This commit is contained in:
commit
a121ac08b3
1 changed files with 5 additions and 1 deletions
|
@ -13,8 +13,12 @@
|
||||||
#include "ScriptAudioInjector.h"
|
#include "ScriptAudioInjector.h"
|
||||||
|
|
||||||
QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* const& in) {
|
QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* const& in) {
|
||||||
|
// The AudioScriptingInterface::playSound method can return null, so we need to account for that.
|
||||||
|
if (!in) {
|
||||||
|
return QScriptValue(QScriptValue::NullValue);
|
||||||
|
}
|
||||||
|
|
||||||
// when the script goes down we want to cleanup the injector
|
// when the script goes down we want to cleanup the injector
|
||||||
|
|
||||||
QObject::connect(engine, &QScriptEngine::destroyed, in, &ScriptAudioInjector::stopInjectorImmediately,
|
QObject::connect(engine, &QScriptEngine::destroyed, in, &ScriptAudioInjector::stopInjectorImmediately,
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue