From 89dbef9eb3ea73259db140a8b1b891ee12af8175 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Mon, 2 May 2011 15:17:18 -0400 Subject: [PATCH] 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 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/core/delete.c b/src/core/delete.c index 030f04563..a6d7018d4 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 (_("%s is not responding."), - window_title); + if (window_title) + tmp = g_markup_printf_escaped (_("%s is not responding."), + window_title); + else + tmp = g_strdup (_("Application is not responding.")); + window_content = g_strdup_printf ( "%s\n\n%s", tmp,