History

cleanup

Brad Hefta-Gaub committed 10 years ago

Commit d1f6b371 parent a4f56263 files · +4 −73Browse files

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

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+4−38
@@ -142,10 +142,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam · 141 unmodified lines
142142 }
143143
144144 ScriptEngine::~ScriptEngine() {
145− qCDebug(scriptengine) << __FUNCTION__ << "--- BEGIN --- script:" << getFilename();
146− qCDebug(scriptengine) << __FUNCTION__ << "called on thread[" << QThread::currentThread() << "], object's thread [" << thread() << "] script:" << getFilename();
147145 qCDebug(scriptengine) << "Script Engine shutting down (destructor) for script:" << getFilename();
148−
149146 auto scriptEngines = DependencyManager::get<ScriptEngines>();
150147 if (scriptEngines) {
151148 qCDebug(scriptengine) << "About to remove ScriptEngine [" << getFilename() << "] from ScriptEngines!";
@@ -154,7 +151,6 @@ ScriptEngine::~ScriptEngine() { · 2 unmodified lines
154151 } else {
155152 qCWarning(scriptengine) << "Script destroyed after ScriptEngines!";
156153 }
157− qCDebug(scriptengine) << __FUNCTION__ << "--- END --- script:" << getFilename();
158154 }
159155
160156 void ScriptEngine::disconnectNonEssentialSignals() {
@@ -1053,36 +1049,6 @@ void ScriptEngine::forwardHandlerCall(const EntityItemID& entityID, const QStrin · 892 unmodified lines
10531049 // since all of these operations can be asynch we will always do the actual work in the response handler
10541050 // for the download
10551051 void ScriptEngine::loadEntityScript(QWeakPointer<ScriptEngine> theEngine, const EntityItemID& entityID, const QString& entityScript, bool forceRedownload) {
1056−
1057−
1058−/*****
1059− if (QThread::currentThread() != thread()) {
1060−#ifdef THREAD_DEBUGGING
1061− qDebug() << "*** WARNING *** ScriptEngine::loadEntityScript() called on wrong thread ["
1062− << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] "
1063− "entityID:" << entityID << "entityScript:" << entityScript <<"forceRedownload:" << forceRedownload;
1064−#endif
1065−
1066− QMetaObject::invokeMethod(this, "loadEntityScript",
1067− Q_ARG(const EntityItemID&, entityID),
1068− Q_ARG(const QString&, entityScript),
1069− Q_ARG(bool, forceRedownload));
1070− return;
1071− }
1072−#ifdef THREAD_DEBUGGING
1073− qDebug() << "ScriptEngine::loadEntityScript() called on correct thread [" << thread() << "] "
1074− "entityID:" << entityID << "entityScript:" << entityScript << "forceRedownload:" << forceRedownload;
1075−#endif
1076−
1077− // If we've been called our known entityScripts should not know about us..
1078− assert(!_entityScripts.contains(entityID));
1079−
1080−#ifdef THREAD_DEBUGGING
1081− qDebug() << "ScriptEngine::loadEntityScript() calling scriptCache->getScriptContents() on thread ["
1082− << QThread::currentThread() << "] expected thread [" << thread() << "]";
1083−#endif
1084−******/
1085−
10861052 // NOTE: If the script content is not currently in the caceh, The LAMBDA here, will be called on the Main Thread
10871053 // which means we're guarenteed that it's not the correct thread for the ScriptEngine. This means
10881054 // when we get into entityScriptContentAvailable() we will likely invokeMethod() to get it over
@@ -1090,15 +1056,15 @@ void ScriptEngine::loadEntityScript(QWeakPointer<ScriptEngine> theEngine, const · 1 unmodified line
10901056 DependencyManager::get<ScriptCache>()->getScriptContents(entityScript, [theEngine, entityID](const QString& scriptOrURL, const QString& contents, bool isURL, bool success) {
10911057 QSharedPointer<ScriptEngine> strongEngine = theEngine.toStrongRef();
10921058 if (strongEngine) {
1093− qDebug() << "ScriptCache::getScriptContents() returned ScriptEngine still active calling ... entityScriptContentAvailable()";
1094−#if 1//def THREAD_DEBUGGING
1059+#ifdef THREAD_DEBUGGING
10951060 qDebug() << "ScriptEngine::entityScriptContentAvailable() IN LAMBDA contentAvailable on thread ["
10961061 << QThread::currentThread() << "] expected thread [" << strongEngine->thread() << "]";
10971062 #endif
1098−
1099−
11001063 strongEngine->entityScriptContentAvailable(entityID, scriptOrURL, contents, isURL, success);
11011064 } else {
1065+ // FIXME - I'm leaving this in for testing, so that QA can confirm that sometimes the script contents
1066+ // returns after the ScriptEngine has been deleted, we can remove this after QA verifies the
1067+ // repro case.
11021068 qDebug() << "ScriptCache::getScriptContents() returned after our ScriptEngine was deleted...";
11031069 }
11041070 }, forceRedownload);