Skip to content

Commit

Permalink
Fix crash on resume in RunnableQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Aug 2, 2019
1 parent b8ccd64 commit e66f75b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/src/main/cpp/native-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ android_main(android_app *aAppState) {

// Attach JNI thread
JNIEnv *jniEnv;
(*aAppState->activity->vm).AttachCurrentThread(&jniEnv, NULL);
(*aAppState->activity->vm).AttachCurrentThread(&jniEnv, nullptr);
sAppContext->mQueue->InitializeJava(jniEnv);

// Create Browser context
crow::VRBrowser::InitializeJava(jniEnv, aAppState->activity->clazz);
Expand Down Expand Up @@ -228,22 +229,26 @@ android_main(android_app *aAppState) {
// Loop until all events are read
// If the activity is paused use a blocking call to read events.
while (ALooper_pollAll(BrowserWorld::Instance().IsPaused() ? -1 : 0,
NULL,
nullptr,
&events,
(void **) &pSource) >= 0) {
// Process event.
if (pSource) {
pSource->process(aAppState, pSource);
}



// Check if we are exiting.
if (aAppState->destroyRequested != 0) {
sAppContext->mEgl->MakeCurrent();
sAppContext->mQueue->ProcessRunnables();
BrowserWorld::Instance().ShutdownGL();
BrowserWorld::Instance().ShutdownJava();
BrowserWorld::Destroy();
sAppContext->mEgl->Destroy();
sAppContext.reset();
sAppContext->mEgl.reset();
sAppContext->mDevice.reset();
aAppState->activity->vm->DetachCurrentThread();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/vrb

0 comments on commit e66f75b

Please sign in to comment.