Merge branch 'gobject-speedup10' into 'main'

gobject: Avoid redundant atomics

See merge request GNOME/glib!2724
This commit is contained in:
Philip Withnall
2022-06-07 11:46:23 +00:00

View File

@@ -319,12 +319,11 @@ g_object_notify_queue_thaw (GObject *object,
GSList *slist; GSList *slist;
guint n_pspecs = 0; guint n_pspecs = 0;
g_return_if_fail (g_atomic_int_get(&object->ref_count) > 0);
G_LOCK(notify_lock); G_LOCK(notify_lock);
/* Just make sure we never get into some nasty race condition */ /* Just make sure we never get into some nasty race condition */
if (G_UNLIKELY(nqueue->freeze_count == 0)) { if (G_UNLIKELY (nqueue->freeze_count == 0))
{
G_UNLOCK (notify_lock); G_UNLOCK (notify_lock);
g_warning ("%s: property-changed notification for %s(%p) is not frozen", g_warning ("%s: property-changed notification for %s(%p) is not frozen",
G_STRFUNC, G_OBJECT_TYPE_NAME (object), object); G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
@@ -332,7 +331,8 @@ g_object_notify_queue_thaw (GObject *object,
} }
nqueue->freeze_count--; nqueue->freeze_count--;
if (nqueue->freeze_count) { if (nqueue->freeze_count)
{
G_UNLOCK (notify_lock); G_UNLOCK (notify_lock);
return; return;
} }
@@ -1394,8 +1394,6 @@ g_object_notify (GObject *object,
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (property_name != NULL); 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 /* We don't need to get the redirect target
* (by, e.g. calling g_object_class_find_property()) * (by, e.g. calling g_object_class_find_property())
@@ -1468,9 +1466,6 @@ g_object_notify_by_pspec (GObject *object,
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (G_IS_PARAM_SPEC (pspec)); 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); g_object_notify_by_spec_internal (object, pspec);
} }