File emacs-libX11-boo1175028.patch of Package emacs.16091

From 72c5f71cd45c860299950cd058d8e13b87375741 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20Mouni=C3=A9?= <Gregory.Mounie@imag.fr>
Date: Sun, 2 Aug 2020 15:56:33 +0200
Subject: [PATCH] Avoid segfaults if XIM is set but not xim_styles

Emacs segfaults at the X11 initialization if XIM is set
and xim_styles is NULL.  This patch avoids the crash.
* src/xfns.c: Check also if FRAME_X_XIM_STYLES(f) is NULL.
(Bug#42676)  (Bug#42673)  (Bug#42677)

Copyright-paperwork-exempt: yes
---
 src/xfns.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- src/xfns.c
+++ src/xfns.c	2020-08-13 07:15:52.715570943 +0000
@@ -2168,9 +2168,15 @@ create_frame_xic (struct frame *f)
   if (FRAME_XIC (f))
     return;
 
+  xim = FRAME_X_XIM (f);
+  if (!xim || ! FRAME_X_XIM_STYLES (f))
+    return;
+
   /* Create X fontset. */
   xfs = xic_create_xfontset (f);
-  xim = FRAME_X_XIM (f);
+  if (!xfs)
+    return;
+
   if (xim)
     {
       XRectangle s_area;
openSUSE Build Service is sponsored by