mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 15:43:17 +02:00
fix script engine shutdown
This commit is contained in:
parent
f013b9af2b
commit
300dd39abf
6 changed files with 7 additions and 25 deletions
|
@ -268,7 +268,7 @@ void Stats::updateStats(bool force) {
|
|||
STAT_UPDATE(audioNoiseGate, audioClient->getNoiseGateOpen() ? "Open" : "Closed");
|
||||
{
|
||||
int localInjectors = audioClient->getNumLocalInjectors();
|
||||
int nonLocalInjectors = DependencyManager::get<AudioInjectorManager>()->getNumInjectors();
|
||||
size_t nonLocalInjectors = DependencyManager::get<AudioInjectorManager>()->getNumInjectors();
|
||||
STAT_UPDATE(audioInjectors, QVector2D(localInjectors, nonLocalInjectors));
|
||||
}
|
||||
|
||||
|
|
|
@ -87,9 +87,11 @@ public:
|
|||
void restart();
|
||||
void finish();
|
||||
|
||||
void finishLocalInjection();
|
||||
void finishNetworkInjection();
|
||||
|
||||
public slots:
|
||||
void finishLocalInjection();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
void restarting();
|
||||
|
|
|
@ -46,16 +46,6 @@ ScriptAudioInjector* AudioScriptingInterface::playSystemSound(SharedSoundPointer
|
|||
}
|
||||
|
||||
ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound, const AudioInjectorOptions& injectorOptions) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
ScriptAudioInjector* injector = NULL;
|
||||
|
||||
BLOCKING_INVOKE_METHOD(this, "playSound",
|
||||
Q_RETURN_ARG(ScriptAudioInjector*, injector),
|
||||
Q_ARG(SharedSoundPointer, sound),
|
||||
Q_ARG(const AudioInjectorOptions&, injectorOptions));
|
||||
return injector;
|
||||
}
|
||||
|
||||
if (sound) {
|
||||
// stereo option isn't set from script, this comes from sound metadata or filename
|
||||
AudioInjectorOptions optionsCopy = injectorOptions;
|
||||
|
|
|
@ -19,13 +19,6 @@ QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* c
|
|||
return QScriptValue(QScriptValue::NullValue);
|
||||
}
|
||||
|
||||
// when the script goes down we want to cleanup the injector
|
||||
QObject::connect(engine, &QScriptEngine::destroyed, DependencyManager::get<AudioInjectorManager>().data(), [&] {
|
||||
qCDebug(scriptengine) << "Script was shutdown, stopping an injector";
|
||||
// FIXME: this doesn't work and leaves the injectors lying around
|
||||
//DependencyManager::get<AudioInjectorManager>()->stop(in->_injector);
|
||||
});
|
||||
|
||||
return engine->newQObject(in, QScriptEngine::ScriptOwnership);
|
||||
}
|
||||
|
||||
|
|
|
@ -260,12 +260,7 @@ bool ScriptEngine::isDebugMode() const {
|
|||
#endif
|
||||
}
|
||||
|
||||
ScriptEngine::~ScriptEngine() {
|
||||
QSharedPointer<ScriptEngines> scriptEngines(_scriptEngines);
|
||||
if (scriptEngines) {
|
||||
scriptEngines->removeScriptEngine(qSharedPointerCast<ScriptEngine>(sharedFromThis()));
|
||||
}
|
||||
}
|
||||
ScriptEngine::~ScriptEngine() {}
|
||||
|
||||
void ScriptEngine::disconnectNonEssentialSignals() {
|
||||
disconnect();
|
||||
|
|
|
@ -591,6 +591,8 @@ void ScriptEngines::onScriptFinished(const QString& rawScriptURL, ScriptEnginePo
|
|||
}
|
||||
}
|
||||
|
||||
removeScriptEngine(engine);
|
||||
|
||||
if (removed && !_isReloading) {
|
||||
// Update settings with removed script
|
||||
saveScripts();
|
||||
|
|
Loading…
Reference in a new issue