diff options
author | Luca Bacci <luca.bacci982@gmail.com> | 2022-08-23 14:54:01 +0200 |
---|---|---|
committer | Luca Bacci <luca.bacci982@gmail.com> | 2022-08-23 14:54:01 +0200 |
commit | d125fcd35ac2a547e7ad698aa8841927c0ef7366 (patch) | |
tree | 9138fc19ef45b5bc5b7c2c3ecdeb3ac796a730be | |
parent | e68925a932ad3d5c1228aaeb6ed89dbe2e30225d (diff) | |
download | gtk+-d125fcd35ac2a547e7ad698aa8841927c0ef7366.tar.gz |
GdkWin32: Position popups on the primary monitor if outside of the visible screen area
Fixes a crash caused by attempting to dereference a NULL GdkMonitor*
in GdkWin32.
See https://gitlab.gnome.org/GNOME/gtk/-/issues/5125
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 6fc15f3815..a94e43b68d 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -1180,6 +1180,11 @@ gdk_win32_surface_layout_popup (GdkSurface *surface, monitor = gdk_surface_get_layout_monitor (surface, layout, gdk_win32_monitor_get_workarea); + if (!monitor) + { + GdkDisplay *display = gdk_surface_get_display (surface); + monitor = gdk_win32_display_get_primary_monitor (display); + } gdk_win32_monitor_get_workarea (monitor, &bounds); gdk_popup_layout_get_shadow_width (layout, |