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

Commit 26c6f83a authored by Jason Macnak's avatar Jason Macnak
Browse files

Avoid trying to disconnect twice with ANGLE

The Vulkan runtime makes all the native_window_* calls
when running with ANGLE.

Noticed while debugging b/184280023.

Bug: b/154237217
Test: MixedDeviceOwnerTest on Cuttlefish w/ SwANGLE
Change-Id: Ie7c5ebcedf6eb0c23fdd1223c0ef866d4a2d9944
parent 2c34aa61
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -82,10 +82,14 @@ egl_surface_t::~egl_surface_t() {


void egl_surface_t::disconnect() {
void egl_surface_t::disconnect() {
    if (win != nullptr && connected) {
    if (win != nullptr && connected) {
        // NOTE: When using Vulkan backend, the Vulkan runtime makes all the
        // native_window_* calls, so don't do them here.
        if (!cnx->useAngle) {
            native_window_set_buffers_format(win, 0);
            native_window_set_buffers_format(win, 0);
            if (native_window_api_disconnect(win, NATIVE_WINDOW_API_EGL)) {
            if (native_window_api_disconnect(win, NATIVE_WINDOW_API_EGL)) {
                ALOGW("EGLNativeWindowType %p disconnect failed", win);
                ALOGW("EGLNativeWindowType %p disconnect failed", win);
            }
            }
        }
        connected = false;
        connected = false;
    }
    }
}
}