Showing the changes to libraries/script-engine/src/ScriptAudioInjector.cpp (1 of 25 files). Show all
Unified · Split
| @@ -20,8 +20,11 @@ QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* c · 19 unmodified lines | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // when the script goes down we want to cleanup the injector | 22 | // when the script goes down we want to cleanup the injector |
| 23 | QObject::connect(engine, &QScriptEngine::destroyed, in, &ScriptAudioInjector::stopInjectorImmediately, | 23 | QObject::connect(engine, &QScriptEngine::destroyed, DependencyManager::get<AudioInjectorManager>().data(), [&] { |
| 24 | Qt::DirectConnection); | 24 | qCDebug(scriptengine) << "Script was shutdown, stopping an injector"; |
| 25 | // FIXME: this doesn't work and leaves the injectors lying around | ||
| 26 | //DependencyManager::get<AudioInjectorManager>()->stop(in->_injector); | ||
| 27 | }); | ||
| 25 | 28 | ||
| 26 | return engine->newQObject(in, QScriptEngine::ScriptOwnership); | 29 | return engine->newQObject(in, QScriptEngine::ScriptOwnership); |
| 27 | } | 30 | } |
| @@ -37,13 +40,5 @@ ScriptAudioInjector::ScriptAudioInjector(const AudioInjectorPointer& injector) : · 9 unmodified lines | |||
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | ScriptAudioInjector::~ScriptAudioInjector() { | 42 | ScriptAudioInjector::~ScriptAudioInjector() { |
| 40 | if (!_injector.isNull()) { | 43 | DependencyManager::get<AudioInjectorManager>()->stop(_injector); |
| 41 | // we've been asked to delete after finishing, trigger a queued deleteLater here | 44 | } |
| 42 | _injector->triggerDeleteAfterFinish(); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | void ScriptAudioInjector::stopInjectorImmediately() { | ||
| 47 | qCDebug(scriptengine) << "ScriptAudioInjector::stopInjectorImmediately called to stop audio injector immediately."; | ||
| 48 | _injector->stop(); | ||
| 49 | } | ||