EGL: add a missing native_window_api_disconnect
Add a native_window_api_disconnect for the case where
processAttributes() fails. Otherwise the next time this
function is called, it'll fail because native window is
still connected to the first API.
Bug: b/118093231
Test: NV internal regression tests including dEQP
Test: EGL_test --gtest_filter=EGLTest.EGLCreateWindowFailAndSucceed
Change-Id: I89712acf5ac40927e975357797a271c1bb680dbc
diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp
index 37408f5..324dc04 100644
--- a/opengl/libs/EGL/egl_platform_entries.cpp
+++ b/opengl/libs/EGL/egl_platform_entries.cpp
@@ -732,6 +732,9 @@
std::vector<AttrType> strippedAttribList;
if (!processAttributes<AttrType>(dp, window, attrib_list, &colorSpace, &strippedAttribList)) {
ALOGE("error invalid colorspace: %d", colorSpace);
+ if (cnx->angleBackend != EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE) {
+ native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
+ }
return EGL_NO_SURFACE;
}
attrib_list = strippedAttribList.data();