Title: [293826] trunk/Source/WebCore
Revision
293826
Author
commit-qu...@webkit.org
Date
2022-05-05 01:33:31 -0700 (Thu, 05 May 2022)

Log Message

REGRESSION(249114@main) [GTK] Crashes on shutdown if the display is not set
https://bugs.webkit.org/show_bug.cgi?id=239767

Patch by Carlos Garcia Campos <cgar...@igalia.com> on 2022-05-05
Reviewed by Michael Catanzaro.

Handle the case of PlatformDisplay created with a nullptr GdkDisplay.

* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::PlatformDisplay):
* platform/graphics/wayland/PlatformDisplayWayland.cpp:
(WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
(WebCore::PlatformDisplayWayland::~PlatformDisplayWayland):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::PlatformDisplayX11):
(WebCore::PlatformDisplayX11::~PlatformDisplayX11):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293825 => 293826)


--- trunk/Source/WebCore/ChangeLog	2022-05-05 08:19:13 UTC (rev 293825)
+++ trunk/Source/WebCore/ChangeLog	2022-05-05 08:33:31 UTC (rev 293826)
@@ -1,3 +1,21 @@
+2022-05-05  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(249114@main) [GTK] Crashes on shutdown if the display is not set
+        https://bugs.webkit.org/show_bug.cgi?id=239767
+
+        Reviewed by Michael Catanzaro.
+
+        Handle the case of PlatformDisplay created with a nullptr GdkDisplay.
+
+        * platform/graphics/PlatformDisplay.cpp:
+        (WebCore::PlatformDisplay::PlatformDisplay):
+        * platform/graphics/wayland/PlatformDisplayWayland.cpp:
+        (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
+        (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland):
+        * platform/graphics/x11/PlatformDisplayX11.cpp:
+        (WebCore::PlatformDisplayX11::PlatformDisplayX11):
+        (WebCore::PlatformDisplayX11::~PlatformDisplayX11):
+
 2022-05-05  Said Abou-Hallawa  <s...@apple.com>
 
         [GPU Process] [iOS] REGRESSION(r293570): Snapshot rendering is not scaled with the device scale factor

Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (293825 => 293826)


--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2022-05-05 08:19:13 UTC (rev 293825)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2022-05-05 08:33:31 UTC (rev 293826)
@@ -177,15 +177,17 @@
     , m_eglDisplay(EGL_NO_DISPLAY)
 #endif
 {
+    if (m_sharedDisplay) {
 #if USE(ATSPI) && USE(GTK4)
-    if (const char* atspiBusAddress = static_cast<const char*>(g_object_get_data(G_OBJECT(display), "-gtk-atspi-bus-address")))
-        m_accessibilityBusAddress = String::fromUTF8(atspiBusAddress);
+        if (const char* atspiBusAddress = static_cast<const char*>(g_object_get_data(G_OBJECT(m_sharedDisplay.get()), "-gtk-atspi-bus-address")))
+            m_accessibilityBusAddress = String::fromUTF8(atspiBusAddress);
 #endif
 
-    g_signal_connect(m_sharedDisplay.get(), "closed", G_CALLBACK(+[](GdkDisplay*, gboolean, gpointer userData) {
-        auto& platformDisplay = *static_cast<PlatformDisplay*>(userData);
-        platformDisplay.sharedDisplayDidClose();
-    }), this);
+        g_signal_connect(m_sharedDisplay.get(), "closed", G_CALLBACK(+[](GdkDisplay*, gboolean, gpointer userData) {
+            auto& platformDisplay = *static_cast<PlatformDisplay*>(userData);
+            platformDisplay.sharedDisplayDidClose();
+        }), this);
+    }
 }
 
 void PlatformDisplay::sharedDisplayDidClose()

Modified: trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp (293825 => 293826)


--- trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp	2022-05-05 08:19:13 UTC (rev 293825)
+++ trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp	2022-05-05 08:33:31 UTC (rev 293826)
@@ -86,7 +86,7 @@
 #if PLATFORM(GTK)
 PlatformDisplayWayland::PlatformDisplayWayland(GdkDisplay* display)
     : PlatformDisplay(display)
-    , m_display(gdk_wayland_display_get_wl_display(display))
+    , m_display(display ? gdk_wayland_display_get_wl_display(display) : nullptr)
 {
 }
 #endif
@@ -99,7 +99,7 @@
     bool nativeDisplayOwned = true;
 #endif
 
-    if (nativeDisplayOwned) {
+    if (nativeDisplayOwned && m_display) {
         m_compositor = nullptr;
         m_registry = nullptr;
         wl_display_disconnect(m_display);

Modified: trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp (293825 => 293826)


--- trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2022-05-05 08:19:13 UTC (rev 293825)
+++ trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2022-05-05 08:33:31 UTC (rev 293826)
@@ -96,7 +96,7 @@
 #if PLATFORM(GTK)
 PlatformDisplayX11::PlatformDisplayX11(GdkDisplay* display)
     : PlatformDisplay(display)
-    , m_display(GDK_DISPLAY_XDISPLAY(display))
+    , m_display(display ? GDK_DISPLAY_XDISPLAY(display) : nullptr)
 {
     clearSharingGLContextAtExit();
 }
@@ -113,7 +113,7 @@
 #else
     bool nativeDisplayOwned = true;
 #endif
-    if (nativeDisplayOwned)
+    if (nativeDisplayOwned && m_display)
         XCloseDisplay(m_display);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to