GNOME Bugzilla – Bug 638838
gdesktopappinfo: Don't crash if we don't have a desktop filename
Last modified: 2011-02-03 13:36:38 UTC
If code creates a GDesktopAppInfo via g_desktop_app_info_new_from_keyfile(), we'd try to send a NULL pointer down into GVariant. Since in this case we don't have a filename, just send the empty string. In the future we should either: 1) Change panel to use g_desktop_app_info_new_from_filename(), and take the hit of parsing the file twice. 2) Add a g_key_file_get_origin_filename() 3) Add g_desktop_app_info_new_from_keyfile_and_name()
Created attachment 177668 [details] [review] gdesktopappinfo: Don't crash if we don't have a desktop filename
<seb128> walters, I can confirm that your patch fixes the gnome-panel crash there
Comment on attachment 177668 [details] [review] gdesktopappinfo: Don't crash if we don't have a desktop filename good, just nitpicks... >- const char *desktop_file, /* filename */ >+ GDesktopAppInfo *info, /* filename */ the comment is wrong now >+ const guint8 *desktop_file_id; it's silly to have this be a guint8* since that requires a cast to or from char* every time you use it. >+ if (info->filename) >+ desktop_file_id = (guint8*) info->filename; >+ else if (info->desktop_id != NULL) >+ desktop_file_id = (guint8*) info->desktop_id; one branch has "!= NULL", the other doesn't.
Attachment 177668 [details] pushed as e738a8d - gdesktopappinfo: Don't crash if we don't have a desktop filename
*** Bug 638937 has been marked as a duplicate of this bug. ***
Just for reference. Solution 3) from the bug description has long had a ready-to-ship patch on https://bugzilla.gnome.org/show_bug.cgi?id=638838. And I think that is needed to solve the deeper issue here - namely that appinfos will often be created without and id or filename.