diff --git a/gobject/gobject.c b/gobject/gobject.c index 8930fde06..5a3b70b5f 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -4502,8 +4502,11 @@ g_value_set_object (GValue *value, g_return_if_fail (G_VALUE_HOLDS_OBJECT (value)); + if G_UNLIKELY (value->data[0].v_pointer == v_object) + return; + old = value->data[0].v_pointer; - + if (v_object) { g_return_if_fail (G_IS_OBJECT (v_object)); diff --git a/gobject/tests/value.c b/gobject/tests/value.c index c294020ed..73a5de650 100644 --- a/gobject/tests/value.c +++ b/gobject/tests/value.c @@ -719,6 +719,7 @@ test_value_transform_object (void) g_value_init (&src, types[s]); g_value_set_object (&src, object); + g_value_set_object (&src, g_value_get_object (&src)); for (d = 0; d < G_N_ELEMENTS (types); d++) {