oryol icon indicating copy to clipboard operation
oryol copied to clipboard

Crash on Android as start init eglDisplay Manager before native window created

Open julee opened this issue 7 years ago • 1 comments

See App.cc, in StartMainLoop(), this->addBlocker(AppState::Init) try to block app init until native window created(readyForInit will call when native window create, this try to unblock app init). But, App::onFrame:

    if ((this->nextState != AppState::InvalidAppState) && (this->nextState != this->curState)) {
        // check if the next state is blocked
        if (this->blockers.Contains(this->nextState)) {
            // yikes, we're blocked
            if (AppState::Blocked != this->curState) {
                Log::Info("App::onFrame(): state '%s' is blocked, switching to Blocked state!\n", AppState::ToString(this->nextState));
                this->curState = AppState::Blocked;
            }
        }
       ..........

block operation only work when nextState is not AppState::InvalidAppState, unfortunately, when app created, it's nextState is AppState::InvalidAppState. So app loop won't block here!

This cause oryol sometimes crash when loop has run but native window has not create yet.

julee avatar Nov 27 '17 02:11 julee

thanks for the bug report! I'll try to have a look soon-ish, haven't checked the Android build for quite a while, maybe something has regressed, or this is a situation which doesn't happen on my device.

floooh avatar Nov 27 '17 07:11 floooh