Skip to content
Permalink
Browse files
REGRESSION(249114@main) [GTK] Crashes on shutdown if the display is n…
…ot set

https://bugs.webkit.org/show_bug.cgi?id=239767

Patch by Carlos Garcia Campos <cgarcia@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):

Canonical link: https://commits.webkit.org/250299@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos authored and webkit-commit-queue committed May 5, 2022
1 parent 29fdbe1 commit 36ee86fdf7a0f4c80d310240b53c4dd8ebb9424c
Showing 4 changed files with 30 additions and 10 deletions.
@@ -1,3 +1,21 @@
2022-05-05 Carlos Garcia Campos <cgarcia@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 <said@apple.com>

[GPU Process] [iOS] REGRESSION(r293570): Snapshot rendering is not scaled with the device scale factor
@@ -177,15 +177,17 @@ PlatformDisplay::PlatformDisplay(GdkDisplay* display)
, 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()
@@ -86,7 +86,7 @@ PlatformDisplayWayland::PlatformDisplayWayland(struct wl_display* display)
#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 @@ PlatformDisplayWayland::~PlatformDisplayWayland()
bool nativeDisplayOwned = true;
#endif

if (nativeDisplayOwned) {
if (nativeDisplayOwned && m_display) {
m_compositor = nullptr;
m_registry = nullptr;
wl_display_disconnect(m_display);
@@ -96,7 +96,7 @@ PlatformDisplayX11::PlatformDisplayX11(Display* display)
#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 @@ PlatformDisplayX11::~PlatformDisplayX11()
#else
bool nativeDisplayOwned = true;
#endif
if (nativeDisplayOwned)
if (nativeDisplayOwned && m_display)
XCloseDisplay(m_display);
}

0 comments on commit 36ee86f

Please sign in to comment.