From 58389dd55fb75f9ce5ecb1917991c5ae0392129e Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 8 Sep 2021 12:51:53 -0700 Subject: [PATCH] egl: Don't try to dereference native displays unless there's a detectable platform Not all native displays are pointers to dereferenceable memory, e.g. DCs on Windows. Don't bother dereferencing if no platforms are available that can be detected that way. Reviewed-by: Eric Engestrom Reviewed By: Bill Kristiansen Acked-by: Roland Scheidegger Part-of: --- src/egl/main/egldisplay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index aa0c2d3a332..739d7d0aac3 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -128,11 +128,10 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay) if (nativeDisplay == EGL_DEFAULT_DISPLAY) return _EGL_INVALID_PLATFORM; +#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) if (_eglPointerIsDereferencable(nativeDisplay)) { void *first_pointer = *(void **) nativeDisplay; - (void) first_pointer; /* silence unused var warning */ - #ifdef HAVE_WAYLAND_PLATFORM /* wl_display is a wl_proxy, which is a wl_object. * wl_object's first element points to the interfacetype. */ @@ -146,6 +145,7 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay) return _EGL_PLATFORM_DRM; #endif } +#endif return _EGL_INVALID_PLATFORM; }