[pygobject: 1/2] gobjectmodule: do not clear floating flag in set_/get_property



commit 1fbf74eb06bbe2868fd40ea9f3fc1addc27e4bc3
Author: Mathieu Duponchelle <mathieu centricular com>
Date:   Sat Jan 20 04:44:46 2018 +0100

    gobjectmodule: do not clear floating flag in set_/get_property

 gi/gobjectmodule.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gi/gobjectmodule.c b/gi/gobjectmodule.c
index ba1b9fc9..b3501eed 100644
--- a/gi/gobjectmodule.c
+++ b/gi/gobjectmodule.c
@@ -168,7 +168,12 @@ pyg_object_set_property (GObject *object, guint property_id,
 
     state = PyGILState_Ensure();
 
-    object_wrapper = pygobject_new(object);
+    object_wrapper = g_object_get_qdata(object, pygobject_wrapper_key);
+
+    if (object_wrapper)
+      Py_INCREF (object_wrapper);
+    else
+      object_wrapper = pygobject_new(object);
 
     if (object_wrapper == NULL) {
        PyGILState_Release(state);
@@ -202,7 +207,12 @@ pyg_object_get_property (GObject *object, guint property_id,
 
     state = PyGILState_Ensure();
 
-    object_wrapper = pygobject_new(object);
+    object_wrapper = g_object_get_qdata(object, pygobject_wrapper_key);
+
+    if (object_wrapper)
+      Py_INCREF (object_wrapper);
+    else
+      object_wrapper = pygobject_new(object);
 
     if (object_wrapper == NULL) {
        PyGILState_Release(state);


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