History

CR feedback

Brad Hefta-Gaub committed 10 years ago

Commit 5f88d951 parent ce46c301 file · +10 −6Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+10−6
@@ -135,7 +135,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam · 134 unmodified lines
135135 }
136136
137137 ScriptEngine::~ScriptEngine() {
138− qDebug() << "Script Engine shutting down (destructor) for script:" << getFilename();
138+ qCDebug(scriptengine) << "Script Engine shutting down (destructor) for script:" << getFilename();
139139
140140 // If we're not already in the middle of stopping all scripts, then we should remove ourselves
141141 // 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
158158 QString scriptEngineName = QString("Script Thread:") + getFilename();
159159 workerThread->setObjectName(scriptEngineName);
160160
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+
161165 // when the worker thread is started, call our engine's run..
162166 connect(workerThread, &QThread::started, this, &ScriptEngine::run);
163167
@@ -184,7 +188,7 @@ void ScriptEngine::stopAllScripts(QObject* application) { · 20 unmodified lines
184188 _allScriptsMutex.lock();
185189 _stoppingAllScripts = true;
186190
187− qDebug() << "Stopping all scripts.... currently known scripts:" << _allKnownScriptEngines.size();
191+ qCDebug(scriptengine) << "Stopping all scripts.... currently known scripts:" << _allKnownScriptEngines.size();
188192
189193 QMutableSetIterator<ScriptEngine*> i(_allKnownScriptEngines);
190194 while (i.hasNext()) {
@@ -223,9 +227,9 @@ void ScriptEngine::stopAllScripts(QObject* application) { · 32 unmodified lines
223227 // We need to wait for the engine to be done running before we proceed, because we don't
224228 // want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing
225229 // any application state after we leave this stopAllScripts() method
226− qDebug() << "waiting on script:" << scriptName;
230+ qCDebug(scriptengine) << "waiting on script:" << scriptName;
227231 scriptEngine->waitTillDoneRunning();
228− qDebug() << "done waiting on script:" << scriptName;
232+ qCDebug(scriptengine) << "done waiting on script:" << scriptName;
229233
230234 // If the script is stopped, we can remove it from our set
231235 i.remove();
@@ -233,7 +237,7 @@ void ScriptEngine::stopAllScripts(QObject* application) { · 1 unmodified line
233237 }
234238 _stoppingAllScripts = false;
235239 _allScriptsMutex.unlock();
236− qDebug() << "DONE Stopping all scripts....";
240+ qCDebug(scriptengine) << "DONE Stopping all scripts....";
237241 }
238242
239243
@@ -1170,7 +1174,7 @@ void ScriptEngine::refreshFileScript(const EntityItemID& entityID) { · 930 unmodified lines
11701174 QString filePath = QUrl(details.scriptText).toLocalFile();
11711175 auto lastModified = QFileInfo(filePath).lastModified().toMSecsSinceEpoch();
11721176 if (lastModified > details.lastModified) {
1173− qDebug() << "Reloading modified script " << details.scriptText;
1177+ qCDebug(scriptengine) << "Reloading modified script " << details.scriptText;
11741178
11751179 QFile file(filePath);
11761180 file.open(QIODevice::ReadOnly);