[mutter] display: trap X errors in get_current_time_roundtrip



commit cc772ddd61be5fcb0412f1f871e5814d841362aa
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Oct 13 19:08:46 2017 -0500

    display: trap X errors in get_current_time_roundtrip
    
    Only return the actual timestamp if we get one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788971

 src/core/display.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index dc4d8df..6fc2ff7 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1326,14 +1326,24 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
     {
       XEvent property_event;
 
+      meta_error_trap_push (display);
+
       XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
                        display->atom__MUTTER_TIMESTAMP_PING,
                        XA_STRING, 8, PropModeAppend, NULL, 0);
-      XIfEvent (display->xdisplay,
-                &property_event,
-                find_timestamp_predicate,
-                (XPointer) display);
-      timestamp = property_event.xproperty.time;
+
+      if (meta_error_trap_pop_with_return (display) == Success)
+        {
+          meta_error_trap_push (display);
+
+          XIfEvent (display->xdisplay,
+                    &property_event,
+                    find_timestamp_predicate,
+                    (XPointer) display);
+
+          if (meta_error_trap_pop_with_return (display) == Success)
+            timestamp = property_event.xproperty.time;
+        }
     }
 
   meta_display_sanity_check_timestamps (display, timestamp);


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