Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -135,7 +135,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam · 134 unmodified lines | ||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | ScriptEngine::~ScriptEngine() { |
| 138 | − qDebug() << "Script Engine shutting down (destructor) for script:" << getFilename(); | |
| 138 | + qCDebug(scriptengine) << "Script Engine shutting down (destructor) for script:" << getFilename(); | |
| 139 | 139 | |
| 140 | 140 | // If we're not already in the middle of stopping all scripts, then we should remove ourselves |
| 141 | 141 | // from the list of running scripts. We don't do this if we're in the process of stopping all scripts |
| @@ -158,6 +158,10 @@ void ScriptEngine::runInThread() { · 16 unmodified lines | ||
| 158 | 158 | QString scriptEngineName = QString("Script Thread:") + getFilename(); |
| 159 | 159 | workerThread->setObjectName(scriptEngineName); |
| 160 | 160 | |
| 161 | + // NOTE: If you connect any essential signals for proper shutdown or cleanup of | |
| 162 | + // the script engine, make sure to add code to "reconnect" them to the | |
| 163 | + // disconnectNonEssentialSignals() method | |
| 164 | + | |
| 161 | 165 | // when the worker thread is started, call our engine's run.. |
| 162 | 166 | connect(workerThread, &QThread::started, this, &ScriptEngine::run); |
| 163 | 167 | |
| @@ -184,7 +188,7 @@ void ScriptEngine::stopAllScripts(QObject* application) { · 20 unmodified lines | ||
| 184 | 188 | _allScriptsMutex.lock(); |
| 185 | 189 | _stoppingAllScripts = true; |
| 186 | 190 | |
| 187 | − qDebug() << "Stopping all scripts.... currently known scripts:" << _allKnownScriptEngines.size(); | |
| 191 | + qCDebug(scriptengine) << "Stopping all scripts.... currently known scripts:" << _allKnownScriptEngines.size(); | |
| 188 | 192 | |
| 189 | 193 | QMutableSetIterator<ScriptEngine*> i(_allKnownScriptEngines); |
| 190 | 194 | while (i.hasNext()) { |
| @@ -223,9 +227,9 @@ void ScriptEngine::stopAllScripts(QObject* application) { · 32 unmodified lines | ||
| 223 | 227 | // We need to wait for the engine to be done running before we proceed, because we don't |
| 224 | 228 | // want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing |
| 225 | 229 | // any application state after we leave this stopAllScripts() method |
| 226 | − qDebug() << "waiting on script:" << scriptName; | |
| 230 | + qCDebug(scriptengine) << "waiting on script:" << scriptName; | |
| 227 | 231 | scriptEngine->waitTillDoneRunning(); |
| 228 | − qDebug() << "done waiting on script:" << scriptName; | |
| 232 | + qCDebug(scriptengine) << "done waiting on script:" << scriptName; | |
| 229 | 233 | |
| 230 | 234 | // If the script is stopped, we can remove it from our set |
| 231 | 235 | i.remove(); |
| @@ -233,7 +237,7 @@ void ScriptEngine::stopAllScripts(QObject* application) { · 1 unmodified line | ||
| 233 | 237 | } |
| 234 | 238 | _stoppingAllScripts = false; |
| 235 | 239 | _allScriptsMutex.unlock(); |
| 236 | − qDebug() << "DONE Stopping all scripts...."; | |
| 240 | + qCDebug(scriptengine) << "DONE Stopping all scripts...."; | |
| 237 | 241 | } |
| 238 | 242 | |
| 239 | 243 | |
| @@ -1170,7 +1174,7 @@ void ScriptEngine::refreshFileScript(const EntityItemID& entityID) { · 930 unmodified lines | ||
| 1170 | 1174 | QString filePath = QUrl(details.scriptText).toLocalFile(); |
| 1171 | 1175 | auto lastModified = QFileInfo(filePath).lastModified().toMSecsSinceEpoch(); |
| 1172 | 1176 | if (lastModified > details.lastModified) { |
| 1173 | − qDebug() << "Reloading modified script " << details.scriptText; | |
| 1177 | + qCDebug(scriptengine) << "Reloading modified script " << details.scriptText; | |
| 1174 | 1178 | |
| 1175 | 1179 | QFile file(filePath); |
| 1176 | 1180 | file.open(QIODevice::ReadOnly); |