[glib] [notify] dispatch 'notify' directly if not frozen
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] [notify] dispatch 'notify' directly if not frozen
- Date: Wed, 16 Nov 2011 17:51:33 +0000 (UTC)
commit ac0ddcf23f4f57efc2f4e6f370022586d7897f6a
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Nov 16 13:02:23 2011 +0000
[notify] dispatch 'notify' directly if not frozen
Avoid the notify queue in the case that we're not already frozen.
gobject/gobject.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 85cad66..0d20a26 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1090,16 +1090,27 @@ static inline void
g_object_notify_by_spec_internal (GObject *object,
GParamSpec *pspec)
{
- GObjectNotifyQueue *nqueue;
GParamSpec *notify_pspec;
notify_pspec = get_notify_pspec (pspec);
if (notify_pspec != NULL)
{
- nqueue = g_object_notify_queue_freeze (object, FALSE);
- g_object_notify_queue_add (object, nqueue, notify_pspec);
- g_object_notify_queue_thaw (object, nqueue);
+ GObjectNotifyQueue *nqueue;
+
+ /* conditional freeze: only increase freeze count if already frozen */
+ nqueue = g_object_notify_queue_freeze (object, TRUE);
+
+ if (nqueue != NULL)
+ {
+ /* we're frozen, so add to the queue and release our freeze */
+ g_object_notify_queue_add (object, nqueue, notify_pspec);
+ g_object_notify_queue_thaw (object, nqueue);
+ }
+ else
+ /* not frozen, so just dispatch the notification directly */
+ G_OBJECT_GET_CLASS (object)
+ ->dispatch_properties_changed (object, 1, ¬ify_pspec);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]