tweaks to script engine shutdown behavior

This commit is contained in:
ZappoMan 2013-12-16 09:32:01 -08:00
parent 524a41468c
commit af52be7860
2 changed files with 13 additions and 2 deletions

View file

@ -263,6 +263,8 @@ Application::~Application() {
delete _settings;
delete _followMode;
delete _glWidget;
qDebug() << "DONE... Application::~Application()\n";
}
void Application::restoreSizeAndPosition() {
@ -4435,8 +4437,8 @@ void Application::loadScript() {
connect(scriptEngine, SIGNAL(finished()), workerThread, SLOT(quit()));
// when the thread is terminated, add both scriptEngine and thread to the deleteLater queue
connect(workerThread, SIGNAL(terminated()), scriptEngine, SLOT(deleteLater()));
connect(workerThread, SIGNAL(terminated()), workerThread, SLOT(deleteLater()));
connect(workerThread, SIGNAL(finished()), scriptEngine, SLOT(deleteLater()));
connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
// when the application is about to quit, stop our script engine so it unwinds properly
connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop()));

View file

@ -102,7 +102,15 @@ void ScriptEngine::run() {
usleep(usecToSleep);
}
if (_isFinished) {
break;
}
QCoreApplication::processEvents();
if (_isFinished) {
break;
}
bool willSendVisualDataCallBack = false;
if (_voxelScriptingInterface.getVoxelPacketSender()->serversExist()) {
@ -138,5 +146,6 @@ void ScriptEngine::run() {
}
}
cleanMenuItems();
qDebug() << "About to emit finished...\n";
emit finished();
}