diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-05-29 18:50:22 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-06-01 11:49:56 -0400 |
commit | b5e1f3426046b8d1855340efc67fc338061f41aa (patch) | |
tree | 6a99410fa5e1118ff3cf94bb023fa6c92fb57d67 | |
parent | a99cebe0c98b622bc7535dc9f531dfdd59cdede1 (diff) | |
download | glib-gobject-speedups.tar.gz |
gobject: Avoid redundant atomicsgobject-speedups
According to the commit that introduced these
calls (4b334ef8f1393c997a2d83d), we are checking
the refcount here to avoid calling g_object_ref
when the refcount is 0, in the rare case that
notification would be triggered during finalize.
But we are now freezing notifications during
finalize, and after recent changes, we no longer call
g_object_ref for notification while a freeze is
in place.
-rw-r--r-- | gobject/gobject.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c index e90fc7b96..bbf516457 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -321,8 +321,6 @@ g_object_notify_queue_thaw (GObject *object, GSList *slist; guint n_pspecs = 0; - g_return_if_fail (g_atomic_int_get(&object->ref_count) > 0); - G_LOCK(notify_lock); /* Just make sure we never get into some nasty race condition */ @@ -335,7 +333,7 @@ g_object_notify_queue_thaw (GObject *object, nqueue->freeze_count--; if (nqueue->freeze_count) { - G_UNLOCK(notify_lock); + G_UNLOCK (notify_lock); return; } @@ -1393,8 +1391,6 @@ g_object_notify (GObject *object, g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (property_name != NULL); - if (g_atomic_int_get (&object->ref_count) == 0) - return; /* We don't need to get the redirect target * (by, e.g. calling g_object_class_find_property()) @@ -1467,9 +1463,6 @@ g_object_notify_by_pspec (GObject *object, g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (G_IS_PARAM_SPEC (pspec)); - if (g_atomic_int_get (&object->ref_count) == 0) - return; - g_object_notify_by_spec_internal (object, pspec); } |