x11-wm/xfce4-wm: Import upsstream patch fixing crashs

xfce4-wm could crash if a broken client tries to usse a nonexistent
icon. Importing upstream patch that avoids the crash.

PR:		262908
Obtained from:	a7971823de
MFH:		2022Q1

(cherry picked from commit 45e9c8923b)
This commit is contained in:
Mikhail Teterin 2022-03-30 10:33:57 +02:00 committed by Guido Falsi
parent c04feb8937
commit 8eb564bc5a
2 changed files with 47 additions and 0 deletions

View file

@ -2,6 +2,7 @@
PORTNAME= xfce4-wm
PORTVERSION= 4.16.1
PORTREVISION= 1
CATEGORIES= x11-wm xfce
MASTER_SITES= XFCE
DISTNAME= xfwm4-${DISTVERSIONFULL}

View file

@ -0,0 +1,46 @@
--- src/icons.c.orig 2021-01-05 08:18:20 UTC
+++ src/icons.c
@@ -295,16 +295,26 @@ static void
}
static void
-get_pixmap_geometry (Display *dpy, Pixmap pixmap, guint *out_width, guint *out_height, guint *out_depth)
+get_pixmap_geometry (ScreenInfo *screen_info, Pixmap pixmap, guint *out_width, guint *out_height, guint *out_depth)
{
Window root;
guint border_width;
gint x, y;
guint width, height;
guint depth;
+ Status rc;
+ int result;
- XGetGeometry (dpy, pixmap, &root, &x, &y, &width, &height, &border_width, &depth);
+ myDisplayErrorTrapPush (screen_info->display_info);
+ rc = XGetGeometry (myScreenGetXDisplay(screen_info), pixmap, &root,
+ &x, &y, &width, &height, &border_width, &depth);
+ result = myDisplayErrorTrapPop (screen_info->display_info);
+ if ((rc != Success) || (result != Success))
+ {
+ return;
+ }
+
if (out_width != NULL)
{
*out_width = width;
@@ -371,12 +381,12 @@ try_pixmap_and_mask (ScreenInfo *screen_info, Pixmap s
return NULL;
}
- get_pixmap_geometry (myScreenGetXDisplay(screen_info), src_pixmap, &w, &h, &depth);
+ get_pixmap_geometry (screen_info, src_pixmap, &w, &h, &depth);
surface = get_surface_from_pixmap (screen_info, src_pixmap, w, h, depth);
if (surface && src_mask != None)
{
- get_pixmap_geometry (myScreenGetXDisplay(screen_info), src_mask, &w, &h, &depth);
+ get_pixmap_geometry (screen_info, src_mask, &w, &h, &depth);
mask_surface = get_surface_from_pixmap (screen_info, src_mask, w, h, depth);
}
else