Skip to content

Commit

Permalink
Fixed startup and shutdown for application with async event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Oct 16, 2014
1 parent f8b3cf2 commit 583567c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion embedding/embedlite/embedhelpers/EmbedLiteSubThread.cpp
Expand Up @@ -41,8 +41,8 @@ void EmbedLiteSubThread::Init()
void EmbedLiteSubThread::CleanUp()
{
LOGT();
mApp->StopChildThread();
profiler_shutdown();
mApp->StopChildThread();
}

bool EmbedLiteSubThread::StartEmbedThread()
Expand Down
17 changes: 6 additions & 11 deletions embedding/embedlite/tests/qtasync/embedLiteCoreInitTestAsync.cpp
Expand Up @@ -21,16 +21,12 @@ class MyListener : public EmbedLiteAppListener
virtual ~MyListener() { }
virtual void Initialized() {
printf("Embedding initialized\n");
mApp->PostTask(&MyListener::StopEmbedding, this);
mApp->Stop();
printf("Embedding stop finished\n");
}
virtual void Destroyed() {
printf("Embedding destroyed\n");
}
static void StopEmbedding(void* aData) {
printf("StopEmbedding\n");
MyListener* self = static_cast<MyListener*>(aData);
self->mApp->Stop();
printf("Embedding stop finished\n");
qApp->quit();
}

private:
Expand All @@ -53,13 +49,12 @@ int main(int argc, char** argv)
bool res = mapp->StartWithCustomPump(EmbedLiteApp::EMBED_THREAD, mQtPump->EmbedLoop());
printf("XUL Symbols loaded: init res:%i\n", res);
app.exec();
delete mQtPump;
printf("Execution stopped\n");
mapp->SetListener(nullptr);
printf("Listener is null\n");
delete listener;
printf("Listener destroed\n");
printf("Listener destroyed\n");
delete mapp;
printf("App destroed\n");
printf("App destroyed\n");
} else {
printf("XUL Symbols failed to load\n");
}
Expand Down
3 changes: 3 additions & 0 deletions ipc/glue/MessagePump.cpp
Expand Up @@ -143,7 +143,10 @@ if (did_work && delayed_work_time_.is_null()
#ifdef MOZ_NUWA_PROCESS
if (!IsNuwaReady() || !IsNuwaProcess())
#endif
{
mDelayedWorkTimer->Cancel();
mDelayedWorkTimer = nullptr;
}

keep_running_ = true;
}
Expand Down

0 comments on commit 583567c

Please sign in to comment.