From e0ed56cc90f28e0988363ca9bd109bbd3c234fd5 Mon Sep 17 00:00:00 2001
From: songchuanfei <songchuanfei@kylinos.com.cn>
Date: Thu, 23 Apr 2020 11:40:48 +0800
Subject: [PATCH] KYOS-B: Fix mate-settings-daemon crash
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- 修复mate-settings-daemon启动时崩溃的问题，具体原因不明

Signed-off-by: songchuanfei <songchuanfei@kylinos.com.cn>
---
 libmate-desktop/mate-rr.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c
index a9bdf79..ed2607e 100644
--- a/libmate-desktop/mate-rr.c
+++ b/libmate-desktop/mate-rr.c
@@ -1205,10 +1205,26 @@ read_edid_data (MateRROutput *output, int *len)
 
 static gboolean check_hotplug_mode_update(MateRROutput *output)
 {
+#ifdef HAVE_RANDR
 	Atom atom;
+	int len;
+	guint8 *result;
 
 	atom = XInternAtom(DISPLAY(output), "hotplug_mode_update", FALSE);
-	return (XRRQueryOutputProperty(DISPLAY(output), output->id, atom) != NULL);
+	if (atom == None)
+		return FALSE;
+        result = get_property (DISPLAY (output),
+			   output->id, atom, &len);
+
+	if (result) {
+		g_free(result);
+		return TRUE;
+	} else
+		return FALSE;
+
+#else
+	return FALSE;
+#endif
 }
 
 gboolean mate_rr_output_has_hotplug_mode_update(MateRROutput *output)
-- 
1.8.3.1

