[mutter] Handle XError and XIOError for unknown displays



commit 708c6162c4ce9ea9eeada4d30da682bbaeaa0af6
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Nov 20 10:42:07 2009 -0500

    Handle XError and XIOError for unknown displays
    
    The atk-bridge GTK+ module opens its own display; if we get an
    XIOError on that display, we shouldn't abort with a meta_bug()
    but just exit normally. Also fix a segfault if we got an XError
    for that display.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604319

 src/core/errors.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/src/core/errors.c b/src/core/errors.c
index 1783801..7b72bf2 100644
--- a/src/core/errors.c
+++ b/src/core/errors.c
@@ -186,10 +186,10 @@ x_error_handler (Display     *xdisplay,
 
   display = meta_display_for_x_display (xdisplay);
 
-  /* Display can be NULL here because the compositing manager
-   * has its own Display, but Xlib only has one global error handler
+  /* Display can be NULL here Xlib only has one global error handler; and
+   * there might be other displays open in the process.
    */
-  if (display->error_traps > 0)
+  if (display && display->error_traps > 0)
     {
       /* we're in an error trap, chain to the trap handler
        * saved from GDK
@@ -228,21 +228,18 @@ x_io_error_handler (Display *xdisplay)
 
   display = meta_display_for_x_display (xdisplay);
 
-  if (display == NULL)
-    meta_bug ("IO error received for unknown display?\n");
-  
   if (errno == EPIPE)
     {
       meta_warning (_("Lost connection to the display '%s';\n"
                       "most likely the X server was shut down or you killed/destroyed\n"
                       "the window manager.\n"),
-                    display->name);
+                    display ? display->name : DisplayString (xdisplay));
     }
   else
     {
       meta_warning (_("Fatal IO error %d (%s) on display '%s'.\n"),
                     errno, g_strerror (errno),
-                    display->name);
+                    display ? display->name : DisplayString (xdisplay));
     }
 
   /* Xlib would force an exit anyhow */



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