summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holthuis <jholthuis@mixxx.org>2022-01-15 16:06:46 +0100
committerJan Holthuis <jholthuis@mixxx.org>2022-01-15 16:06:46 +0100
commit0cc21b4e474fa952a584b644ce534ee34d5cd940 (patch)
tree1e898c17558e22f4d629625e96cc3eb792941536
parentf1c721757085d9b81b92a6d61d7f5528ecca840d (diff)
ControllerScriptEngineLegacy: Only remove FS watcher paths if not empty
Fixes this warning: warning [0x56043d58fd00] QFileSystemWatcher::removePaths: list is empty
-rw-r--r--src/controllers/scripting/legacy/controllerscriptenginelegacy.cpp9
-rw-r--r--src/controllers/scripting/legacy/controllerscriptenginelegacy.h5
2 files changed, 10 insertions, 4 deletions
diff --git a/src/controllers/scripting/legacy/controllerscriptenginelegacy.cpp b/src/controllers/scripting/legacy/controllerscriptenginelegacy.cpp
index babc9c2bbd..24ffbd2744 100644
--- a/src/controllers/scripting/legacy/controllerscriptenginelegacy.cpp
+++ b/src/controllers/scripting/legacy/controllerscriptenginelegacy.cpp
@@ -90,6 +90,15 @@ QJSValue ControllerScriptEngineLegacy::wrapFunctionCode(
return wrappedFunction;
}
+void ControllerScriptEngineLegacy::setScriptFiles(
+ const QList<LegacyControllerMapping::ScriptFileInfo>& scripts) {
+ const QStringList paths = m_fileWatcher.files();
+ if (!paths.isEmpty()) {
+ m_fileWatcher.removePaths(paths);
+ }
+ m_scriptFiles = scripts;
+}
+
bool ControllerScriptEngineLegacy::initialize() {
if (!ControllerScriptEngineBase::initialize()) {
return false;
diff --git a/src/controllers/scripting/legacy/controllerscriptenginelegacy.h b/src/controllers/scripting/legacy/controllerscriptenginelegacy.h
index 5a997ff619..3e70b69a7a 100644
--- a/src/controllers/scripting/legacy/controllerscriptenginelegacy.h
+++ b/src/controllers/scripting/legacy/controllerscriptenginelegacy.h
@@ -27,10 +27,7 @@ class ControllerScriptEngineLegacy : public ControllerScriptEngineBase {
QJSValue wrapFunctionCode(const QString& codeSnippet, int numberOfArgs);
public slots:
- void setScriptFiles(const QList<LegacyControllerMapping::ScriptFileInfo>& scripts) {
- m_fileWatcher.removePaths(m_fileWatcher.files());
- m_scriptFiles = scripts;
- }
+ void setScriptFiles(const QList<LegacyControllerMapping::ScriptFileInfo>& scripts);
private:
bool evaluateScriptFile(const QFileInfo& scriptFile);