Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1b982f3 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Fix crash regression when calling setSurface(null)"

parents 93a9e276 e95c62d7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -184,8 +184,10 @@ static void android_view_ThreadedRenderer_setSurface(JNIEnv* env, jobject clazz,
        proxy->setSwapBehavior(SwapBehavior::kSwap_discardBuffer);
    }
    proxy->setSurface(window, enableTimeout);
    if (window) {
        ANativeWindow_release(window);
    }
}

static jboolean android_view_ThreadedRenderer_pause(JNIEnv* env, jobject clazz,
        jlong proxyPtr) {
+2 −2
Original line number Diff line number Diff line
@@ -77,10 +77,10 @@ void RenderProxy::setName(const char* name) {
}

void RenderProxy::setSurface(ANativeWindow* window, bool enableTimeout) {
    ANativeWindow_acquire(window);
    if (window) { ANativeWindow_acquire(window); }
    mRenderThread.queue().post([this, win = window, enableTimeout]() mutable {
        mContext->setSurface(win, enableTimeout);
        ANativeWindow_release(win);
        if (win) { ANativeWindow_release(win); }
    });
}