[gnome-settings-daemon/gnome-3-8] media-keys: don't crash when calling GrabAccelerators with an empty list



commit 95f242c15222b0821c03676d52c82c4dba6ec07a
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri May 10 17:53:29 2013 +0200

    media-keys: don't crash when calling GrabAccelerators with an empty list
    
    If you use an indefinite type like "a*", you must add at least one
    element so that GVariant can compute the correct type. Otherwise,
    you need to specify the right type from the start.
    
    The empty list is an edge case that can happen if gnome-shell crashes
    at startup: gnome-settings-daemon notices that the shell is coming
    up, it builds the internal list and calls GrabAccelerator the first
    time; this fails because gnome-shell is not ready yet, so g-s-d
    installs a timeout to retry; meanwhile g-s goes down again, so
    g-s-d clears the list, and the next time the timeout fires g-s-d
    crashes.
    This fix is not correct, we should actually rebuild the internal
    list if we ever get in this state, but as this is only possible
    with a shell crashing at startup, let's go with the simple way.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700091

 plugins/media-keys/gsd-media-keys-manager.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 5b66ba3..4239db9 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -491,7 +491,7 @@ grab_media_keys (GsdMediaKeysManager *manager)
         GVariantBuilder builder;
         int i;
 
-        g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+        g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(su)"));
 
         for (i = 0; i < manager->priv->keys->len; i++) {
                 MediaKey *key;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]