GNOME Bugzilla – Bug 648416
g_app_info_create_from_commandline ignores SUPPORTS_STARTUP_NOTIFICATION
Last modified: 2011-04-25 12:35:26 UTC
g_app_info_create_from_commandline does the following to check for STARTUP_NOTIFICATION: info->startup_notify = flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION; But info->startup_notify was declared like so: guint startup_notify : 1; While G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION was declared like so: G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION = (1 << 2) So what the first line of code does is try to assign the number 4 to a field that can only hold 0 or 1. Thus guaranteeing that no such AppInfo object can support startup notification. I'll attach a short vala test case and a patch.
Created attachment 186447 [details] Test case Compile with: valac --pkg=gtk+-3.0 startup.vala Run with: ./startup You should see a spinner if glib is behaving correctly (we're lying here to glib, so you'll see the spinner until it times out, but you should see it).
Created attachment 186448 [details] [review] Proposed patch
Usually in glib, gtk etc this is written like so: bit_in_bitfield = (flags & FLAG) != 0;
Created attachment 186452 [details] [review] Standard style Ah, OK. Here's one with the recommended style. Thanks!
Review of attachment 186452 [details] [review]: Looks good otherwise. ::: gio/gdesktopappinfo.c @@ +1659,2 @@ info->hidden = FALSE; if (flags & G_APP_INFO_CREATE_SUPPORTS_URIS) Should probably add the '!= 0' in line 1660 as well, while we are at it.
commit a330c2f19f5086986940e57bdf1e7db651db725c Author: Michael Terry <michael.terry@canonical.com> Date: Mon Apr 25 08:29:35 2011 -0400 Don't ignore SUPPORTS_STARTUP_NOTIFICATION for commandline GAppInfos https://bugzilla.gnome.org/show_bug.cgi?id=648416