[pygobject/pygobject-2-28: 4/4] Decrease the refcount for GInitiallyUnowned constructors.



commit a535e4af7c38fd7917d804470e8c46da4c2a86ea
Author: Steve Frécinaux <code istique net>
Date:   Wed Feb 9 17:32:03 2011 +0100

    Decrease the refcount for GInitiallyUnowned constructors.
    
    This mimicks the weird legacy pygtk behaviour and makes all the tests
    pass despite the proper fixes having been reverted.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641525

 gi/pygi-invoke.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index e998df7..c93442a 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -700,6 +700,10 @@ _process_invocation_state (struct invocation_state *state,
                     /* The new wrapper increased the reference count, so decrease it. */
                     g_object_unref (state->return_arg.v_pointer);
                 }
+                if (state->is_constructor && G_IS_INITIALLY_UNOWNED (state->return_arg.v_pointer)) {
+                    /* GInitiallyUnowned constructors always end up with one extra reference, so decrease it. */
+                    g_object_unref (state->return_arg.v_pointer);
+                }
                 break;
             default:
                 /* Other types don't have neither methods nor constructors. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]