[gnome-desktop/gnome-3-8] gnome-rr: Fix crash when XRRSetCrtcConfig() fails



commit 70b279794245807a613dd341c29bc5de99b02972
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jun 25 11:00:58 2013 +0200

    gnome-rr: Fix crash when XRRSetCrtcConfig() fails
    
    It's possible for XRRSetCrtcConfig() to fail so we should
    wrap it in gkd_error_traps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703034

 libgnome-desktop/gnome-rr.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 58aaacc..5ae52b2 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -2248,7 +2248,8 @@ gnome_rr_crtc_set_config_with_time (GnomeRRCrtc      *crtc,
        for (i = 0; i < n_outputs; ++i)
            g_array_append_val (output_ids, outputs[i]->id);
     }
-    
+
+    gdk_error_trap_push ();
     status = XRRSetCrtcConfig (DISPLAY (crtc), info->resources, crtc->id,
                               timestamp, 
                               x, y,
@@ -2259,16 +2260,16 @@ gnome_rr_crtc_set_config_with_time (GnomeRRCrtc      *crtc,
     
     g_array_free (output_ids, TRUE);
 
-    if (status == RRSetConfigSuccess)
-       result = TRUE;
-    else {
-       result = FALSE;
+    if (gdk_error_trap_pop () || status != RRSetConfigSuccess) {
        /* Translators: CRTC is a CRT Controller (this is X terminology).
         * It is *very* unlikely that you'll ever get this error, so it is
         * only listed for completeness. */
        g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_RANDR_ERROR,
                     _("could not set the configuration for CRTC %d"),
                     (int) crtc->id);
+        return FALSE;
+    } else {
+        result = TRUE;
     }
     
     return result;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]