Fix a segfault if the GAppInfo does not have an icon

This fixes the following backtrace:

 0  g_logv (log_domain=0x7ffff60461a4 "GLib-GObject", log_level=<optimized out>,
    format=0x7ffff599c322 "%s: assertion `%s' failed", args1=0x7fffffffc418) at gmessages.c:577
 1  0x00007ffff59312d2 in g_log (log_domain=<optimized out>, log_level=<optimized out>,
    format=<optimized out>) at gmessages.c:591
 2  0x00007ffff601c3c7 in g_object_ref (_object=0x0) at gobject.c:2648
 3  0x00007ffff7721e22 in gdk_x11_app_launch_context_get_startup_notify_id (context=<optimized out>,
    info=0x7fffe8004b40, files=<optimized out>) at gdkapplaunchcontext-x11.c:331
 4  0x00007ffff62e60d0 in _g_desktop_app_info_launch_uris_internal (appinfo=0x7fffe8004b40, uris=0x0,
    launch_context=0x7fffe401c800, spawn_flags=G_SPAWN_SEARCH_PATH, user_setup=0, user_setup_data=0x0,
    pid_callback=0, pid_callback_data=0x0, error=0x7fffffffc848) at gdesktopappinfo.c:1269
 5  0x00007ffff62e630a in g_desktop_app_info_launch_uris (appinfo=<optimized out>, uris=<optimized out>,
    launch_context=<optimized out>, error=<optimized out>) at gdesktopappinfo.c:1341
 6  0x00007ffff62e636b in g_desktop_app_info_launch (appinfo=0x7fffe8004b40, files=<optimized out>,
    launch_context=0x7fffe401c800, error=0x7fffffffc848) at gdesktopappinfo.c:1388
This commit is contained in:
Richard Hughes 2011-09-13 16:16:28 +01:00
parent 415d916129
commit 14df59d47c

View File

@ -328,13 +328,15 @@ gdk_x11_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
if (icon == NULL)
{
icon = g_app_info_get_icon (info);
g_object_ref (icon);
if (icon != NULL)
g_object_ref (icon);
}
if (icon)
icon_name = gicon_to_string (icon);
g_object_unref (icon);
if (icon != NULL)
{
icon_name = gicon_to_string (icon);
g_object_unref (icon);
}
}
binary_name = g_app_info_get_executable (info);