kuuko pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=c1e51903fe062c8471f54ba49a807b85990b641b

commit c1e51903fe062c8471f54ba49a807b85990b641b
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Sun Mar 8 19:20:58 2015 +0200

    Evas.SmartObject: Fix crash when Smart is re-used
---
 efl/evas/efl.evas_object_smart.pxi | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/efl/evas/efl.evas_object_smart.pxi 
b/efl/evas/efl.evas_object_smart.pxi
index b64deed..aa7471f 100644
--- a/efl/evas/efl.evas_object_smart.pxi
+++ b/efl/evas/efl.evas_object_smart.pxi
@@ -52,9 +52,7 @@ cdef void _smart_object_delete(Evas_Object *o) with gil:
     #     eo_event_callback_del(EO_EV_DEL, _eo_event_del_cb, <const void 
*>self))
     #eo_do(o, eo_key_data_del("python-eo"))
     evas_object_smart_data_set(obj.obj, NULL)
-    #cls.cls = NULL
     obj.obj = NULL
-    Py_DECREF(cls)
     Py_DECREF(obj)
 
 
@@ -382,6 +380,11 @@ cdef class Smart:
         cls_def.data = <void *>self
 
         self.cls = evas_smart_class_new(cls_def)
+        Py_INCREF(self)
+
+    def delete(self):
+        evas_smart_free(self.cls)
+        Py_DECREF(self)
 
     @staticmethod
     def delete(obj):
@@ -570,7 +573,6 @@ cdef class SmartObject(Object):
         #_smart_classes.append(<uintptr_t>cls_def)
         self._set_obj(evas_object_smart_add(canvas.obj, smart.cls))
         self._set_properties_from_keyword_args(kwargs)
-        Py_INCREF(smart)
 
     cdef int _set_obj(self, cEo *obj) except 0:
         assert self.obj == NULL, "Object must be clean"

-- 


Reply via email to