diff options
author | Monsta <[email protected]> | 2015-07-24 13:26:48 +0300 |
---|---|---|
committer | Monsta <[email protected]> | 2015-07-24 13:26:48 +0300 |
commit | 6830d2560e3db172c1042b8811f744a7351cf7c2 (patch) | |
tree | c42f6a89206725d6d8853090970314571797f599 | |
parent | fe0d234192debe109736b78f08f98a808758c42b (diff) | |
download | mate-desktop-6830d2560e3db172c1042b8811f744a7351cf7c2.tar.bz2 mate-desktop-6830d2560e3db172c1042b8811f744a7351cf7c2.tar.xz |
rr: fix crash when XRRSetCrtcConfig fails
from https://github.com/GNOME/gnome-desktop/commit/4a95c179de8920ee8f78ae5e1f05df173e9d5bd8
-rw-r--r-- | libmate-desktop/mate-rr.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c index d2003ac..65b4811 100644 --- a/libmate-desktop/mate-rr.c +++ b/libmate-desktop/mate-rr.c @@ -1750,7 +1750,8 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *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, @@ -1761,16 +1762,16 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc, g_array_free (output_ids, TRUE); - if (status == RRSetConfigSuccess) - result = TRUE; - else { - result = FALSE; - /* 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, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR, - _("could not set the configuration for CRTC %d"), - (int) crtc->id); + 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, MATE_RR_ERROR, MATE_RR_ERROR_RANDR_ERROR, + _("could not set the configuration for CRTC %d"), + (int) crtc->id); + return FALSE; + } else { + result = TRUE; } return result; |