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
This commit is contained in:
Owen W. Taylor 2011-05-02 15:17:18 -04:00
parent 60dd31ed48
commit 89dbef9eb3

View File

@ -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,