ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00317
[Branch ~notify-osd-developers/notify-osd/main] Rev 395: Merged my fix-427924 branch after review and approval, fixing LP: #427924
Merge authors:
Mirco Müller (macslow)
Related merge proposals:
https://code.launchpad.net/~macslow/notify-osd/fix-427924/+merge/12281
proposed by: Mirco Müller (macslow)
review: Approve - David Barth (dbarth)
------------------------------------------------------------
revno: 395 [merge]
committer: Mirco Müller <mirco.mueller@xxxxxxxxxx>
branch nick: notify-osd
timestamp: Thu 2009-09-24 12:12:42 +0200
message:
Merged my fix-427924 branch after review and approval, fixing LP: #427924
a crasher in a glib closure marshaler.
modified:
src/display.c
src/stack.c
--
lp:notify-osd
https://code.launchpad.net/~notify-osd-developers/notify-osd/main
Your team ayatana-commits is subscribed to branch lp:notify-osd.
To unsubscribe from this branch go to https://code.launchpad.net/~notify-osd-developers/notify-osd/main/+edit-subscription.
=== modified file 'src/display.c'
--- src/display.c 2009-09-10 13:11:32 +0000
+++ src/display.c 2009-09-23 13:14:20 +0000
@@ -286,8 +286,6 @@
g_return_if_fail (self != NULL);
- stack_purge_old_bubbles (self);
-
bubble = stack_select_next_to_display (self);
if (bubble == NULL)
/* this actually happens when we're called for a synchronous
=== modified file 'src/stack.c'
--- src/stack.c 2009-09-10 13:11:32 +0000
+++ src/stack.c 2009-09-23 15:42:38 +0000
@@ -245,34 +245,13 @@
return (Bubble*) entry->data;
}
-
static void
-stack_purge_old_bubbles (Stack* self)
+_weak_notify_cb (gpointer data,
+ GObject* former_object)
{
- Bubble* bubble = NULL;
- GList* list = NULL;
-
- g_return_if_fail (self != NULL);
-
- for (list = g_list_first (self->list);
- list != NULL;)
- {
- bubble = (Bubble*) list->data;
-
- if (! IS_BUBBLE (bubble))
- {
- self->list = g_list_delete_link (self->list, list);
- list = self->list;
- } else if (! bubble_is_visible (bubble) &&
- (bubble_get_timeout (bubble) == 0))
- {
- self->list = g_list_delete_link (self->list, list);
- list = self->list;
- g_object_unref (bubble);
- } else {
- list = g_list_next (list);
- }
- }
+ Stack* stack = STACK (data);
+
+ stack->list = g_list_remove (stack->list, former_object);
}
static void
@@ -618,6 +597,10 @@
gchar *sender;
new_bubble = TRUE;
bubble = bubble_new (self->defaults);
+ g_object_weak_ref (G_OBJECT (bubble),
+ _weak_notify_cb,
+ (gpointer) self);
+
sender = dbus_g_method_get_sender (context);
bubble_set_sender (bubble, sender);
g_free (sender);
@@ -627,7 +610,8 @@
{
data = (GValue*) g_hash_table_lookup (hints, "x-canonical-append");
compat = (GValue*) g_hash_table_lookup (hints, "append");
- if (G_VALUE_HOLDS_STRING (data) || G_VALUE_HOLDS_STRING (compat))
+ if ((data && G_VALUE_HOLDS_STRING (data)) ||
+ (compat && G_VALUE_HOLDS_STRING (compat)))
bubble_set_append (bubble, TRUE);
else
bubble_set_append (bubble, FALSE);
@@ -656,7 +640,7 @@
{
data = (GValue*) g_hash_table_lookup (hints, "x-canonical-private-synchronous");
compat = (GValue*) g_hash_table_lookup (hints, "synchronous");
- if (G_VALUE_HOLDS_STRING (data) || G_VALUE_HOLDS_STRING (compat))
+ if ((data && G_VALUE_HOLDS_STRING (data)) || (compat && G_VALUE_HOLDS_STRING (compat)))
{
if (sync_bubble != NULL
&& IS_BUBBLE (sync_bubble))
@@ -665,10 +649,10 @@
bubble = sync_bubble;
}
- if (G_VALUE_HOLDS_STRING (data))
+ if (data && G_VALUE_HOLDS_STRING (data))
bubble_set_synchronous (bubble, g_value_get_string (data));
- if (G_VALUE_HOLDS_STRING (compat))
+ if (compat && G_VALUE_HOLDS_STRING (compat))
bubble_set_synchronous (bubble, g_value_get_string (compat));
}
}
@@ -676,14 +660,14 @@
if (hints)
{
data = (GValue*) g_hash_table_lookup (hints, "value");
- if (G_VALUE_HOLDS_INT (data))
+ if (data && G_VALUE_HOLDS_INT (data))
bubble_set_value (bubble, g_value_get_int (data));
}
if (hints)
{
data = (GValue*) g_hash_table_lookup (hints, "urgency");
- if (G_VALUE_HOLDS_UCHAR (data))
+ if (data && G_VALUE_HOLDS_UCHAR (data))
bubble_set_urgency (bubble,
g_value_get_uchar (data));
/* Note: urgency was defined as an enum: LOW, NORMAL, CRITICAL
@@ -695,7 +679,7 @@
{
data = (GValue*) g_hash_table_lookup (hints, "x-canonical-private-icon-only");
compat = (GValue*) g_hash_table_lookup (hints, "icon-only");
- if (G_VALUE_HOLDS_STRING (data) || G_VALUE_HOLDS_STRING (compat))
+ if ((data && G_VALUE_HOLDS_STRING (data)) || (compat && G_VALUE_HOLDS_STRING (compat)))
bubble_set_icon_only (bubble, TRUE);
else
bubble_set_icon_only (bubble, FALSE);
@@ -764,7 +748,8 @@
stack_layout (self);
}
- dbus_g_method_return (context, bubble_get_id (bubble));
+ if (bubble)
+ dbus_g_method_return (context, bubble_get_id (bubble));
return TRUE;
}
@@ -774,20 +759,27 @@
guint id,
GError** error)
{
- Bubble *bubble = find_bubble_by_id (self, id);
-
- /* exit but pretend it's ok, for applications
- that call us after an action button was clicked */
+ if (id == 0)
+ g_warning ("%s(): notification id == 0, likely wrong\n",
+ G_STRFUNC);
+
+ Bubble* bubble = find_bubble_by_id (self, id);
+
+ // exit but pretend it's ok, for applications
+ // that call us after an action button was clicked
if (bubble == NULL)
return TRUE;
dbus_send_close_signal (bubble_get_sender (bubble),
bubble_get_id (bubble),
3);
- bubble_hide (bubble);
- g_object_unref (bubble);
- stack_layout (self);
+ // do not trigger any closure of a notification-bubble here, as
+ // this kind of control from outside (DBus) does not comply with
+ // the notify-osd specification
+ //bubble_hide (bubble);
+ //g_object_unref (bubble);
+ //stack_layout (self);
return TRUE;
}