mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 10:08:56 +01:00 
			
		
		
		
	Deal with startup notify id being NULL
The app launch context may just not support startup notification, in which case, g_app_launch_context_get_startup_notify_id() will return NULL. Failure to take this into account leads to criticals like this: gnome-session[8489]: GLib-CRITICAL: g_variant_new_take_string: assertion 'string != NULL' failed gnome-session[8489]: GLib-CRITICAL: g_variant_new_variant: assertion 'value != NULL' failed gnome-session[8489]: GLib-CRITICAL: g_variant_get_type: assertion 'value != NULL' failed gnome-session[8489]: GLib-CRITICAL: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (type)' failed https://bugzilla.gnome.org/show_bug.cgi?id=728066
This commit is contained in:
		@@ -2182,7 +2182,11 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo            *info,
 | 
			
		||||
              sn_id = g_app_launch_context_get_startup_notify_id (launch_context,
 | 
			
		||||
                                                                  G_APP_INFO (info),
 | 
			
		||||
                                                                  launched_files);
 | 
			
		||||
              envp = g_environ_setenv (envp, "DESKTOP_STARTUP_ID", sn_id, TRUE);
 | 
			
		||||
              if (sn_id)
 | 
			
		||||
                {
 | 
			
		||||
                  envp = g_environ_setenv (envp, "DESKTOP_STARTUP_ID", sn_id, TRUE);
 | 
			
		||||
                  g_free (sn_id);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
          g_list_free_full (launched_files, g_object_unref);
 | 
			
		||||
@@ -2289,7 +2293,8 @@ g_desktop_app_info_make_platform_data (GDesktopAppInfo   *info,
 | 
			
		||||
          gchar *sn_id;
 | 
			
		||||
 | 
			
		||||
          sn_id = g_app_launch_context_get_startup_notify_id (launch_context, G_APP_INFO (info), launched_files);
 | 
			
		||||
          g_variant_builder_add (&builder, "{sv}", "desktop-startup-id", g_variant_new_take_string (sn_id));
 | 
			
		||||
          if (sn_id)
 | 
			
		||||
            g_variant_builder_add (&builder, "{sv}", "desktop-startup-id", g_variant_new_take_string (sn_id));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      g_list_free_full (launched_files, g_object_unref);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user