GNOME Bugzilla – Bug 651209
segfault in gtk_icon_info_load_symbolic when icon is not found
Last modified: 2011-09-07 19:35:49 UTC
Users of Gentoo and Fedora have reported segfaults in nautilus-3.0.x in gtk_icon_info_load_symbolic (see http://bugs.gentoo.org/show_bug.cgi?id=365779, https://bugzilla.redhat.com/show_bug.cgi?id=690357, https://bugzilla.redhat.com/show_bug.cgi?id=693636). One of them was helpful enough to post a backtrace with debugging information: https://bugzilla.redhat.com/attachment.cgi?id=489928 The backtrace shows that the crash occurs because we are passing a NULL icon_info to gtk_icon_info_load_symbolic in lookup_and_color_symbolic_find in nautilus-search-bar.c; indeed, icon_info will be NULL if gtk_icon_theme_lookup_icon fails to find an icon. An identical problem exists in get_eject_icon in nautilus-places-sidebar.c, where gtk_icon_info_load_symbolic_for_context and gtk_icon_theme_lookup_by_gicon are used. The solution is to check for the NULL icon_info, and return a NULL GdkPixbuf. Note that returning a NULL from lookup_and_color_symbolic_find and get_eject_icon is safe: in both cases, the return value is only used in functions that can safely deal with a NULL (although some of them will print error messages in complaint).
Created attachment 188726 [details] [review] Patch to prevent the segfault
I committed a cleanup of the entry code to git master, which should also fix this kind of crashes when icons are missing from the theme.