git: 45e9c8923b1f - main - x11-wm/xfce4-wm: Import upsstream patch fixing crashs

From: Guido Falsi <madpilot_at_FreeBSD.org>
Date: Wed, 30 Mar 2022 08:37:21 UTC
The branch main has been updated by madpilot:

URL: https://cgit.FreeBSD.org/ports/commit/?id=45e9c8923b1f38f856b2df9b7385cabbff95d82c

commit 45e9c8923b1f38f856b2df9b7385cabbff95d82c
Author:     Mikhail Teterin <mi@FreeBSD.org>
AuthorDate: 2022-03-30 08:33:57 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-03-30 08:36:38 +0000

    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:  https://gitlab.xfce.org/xfce/xfwm4/-/commit/a7971823de40a17dcba940fcef56d781626826d3
    MFH:            2022Q1
---
 x11-wm/xfce4-wm/Makefile                |  1 +
 x11-wm/xfce4-wm/files/patch-src_icons.c | 46 +++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/x11-wm/xfce4-wm/Makefile b/x11-wm/xfce4-wm/Makefile
index dcbb0d370cfd..e61018553c3d 100644
--- a/x11-wm/xfce4-wm/Makefile
+++ b/x11-wm/xfce4-wm/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	xfce4-wm
 PORTVERSION=	4.16.1
+PORTREVISION=	1
 CATEGORIES=	x11-wm xfce
 MASTER_SITES=	XFCE
 DISTNAME=	xfwm4-${DISTVERSIONFULL}
diff --git a/x11-wm/xfce4-wm/files/patch-src_icons.c b/x11-wm/xfce4-wm/files/patch-src_icons.c
new file mode 100644
index 000000000000..564d90fd25fd
--- /dev/null
+++ b/x11-wm/xfce4-wm/files/patch-src_icons.c
@@ -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