[mutter] Fix crash with non-responding application with no title



commit 89dbef9eb3ea73259db140a8b1b891ee12af8175
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon May 2 15:17:18 2011 -0400

    Fix crash with non-responding application with no title
    
    If a window had no title property set, then the
    application-not-responding dialog would cause Mutter to crash
    because window->title was NULL; handle that case and use the
    string "Application is not responding."
    
    https://bugzilla.gnome.org/show_bug.cgi?id=649114

 src/core/delete.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/src/core/delete.c b/src/core/delete.c
index 030f045..a6d7018 100644
--- a/src/core/delete.c
+++ b/src/core/delete.c
@@ -88,19 +88,31 @@ delete_ping_timeout_func (MetaDisplay *display,
       return;
     }
 
-  /* This is to get a bit better string if the title isn't representable
+  /* This is to get a better string if the title isn't representable
    * in the locale encoding; actual conversion to UTF-8 is done inside
    * meta_show_dialog */
-  tmp = g_locale_from_utf8 (window->title, -1, NULL, NULL, NULL);
-  if (tmp == NULL)
-    window_title = "???";
+
+  if (window->title && window->title[0])
+    {
+      tmp = g_locale_from_utf8 (window->title, -1, NULL, NULL, NULL);
+      if (tmp == NULL)
+        window_title = NULL;
+      else
+        window_title = window->title;
+      g_free (tmp);
+    }
   else
-    window_title = window->title;
-  g_free (tmp);
+    {
+      window_title = NULL;
+    }
 
   /* Translators: %s is a window title */
-  tmp = g_markup_printf_escaped (_("<tt>%s</tt> is not responding."),
-                                 window_title);
+  if (window_title)
+    tmp = g_markup_printf_escaped (_("<tt>%s</tt> is not responding."),
+                                   window_title);
+  else
+    tmp = g_strdup (_("Application is not responding."));
+
   window_content = g_strdup_printf (
       "<big><b>%s</b></big>\n\n<i>%s</i>",
       tmp,



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