mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 06:53:00 +02:00
Attempting to resolve possible crash case for scripts playing sounds
This commit is contained in:
parent
20d77fae3c
commit
2575352485
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