kuuko pushed a commit to branch master.

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

commit a70c42e6814a5368164e749ff497c215519314a4
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Sat Apr 15 16:50:27 2017 +0300

    elm: Don't allow FontProperties to be freed manually
    
    This could easily lead to segfaults and double frees if the lifetime of the 
Python object is not managed carefully.
    
    We now do the free automatically when the object no longer has references 
to it.
---
 efl/elementary/__init__.pyx | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/efl/elementary/__init__.pyx b/efl/elementary/__init__.pyx
index c1e6c90..b1f58b8 100644
--- a/efl/elementary/__init__.pyx
+++ b/efl/elementary/__init__.pyx
@@ -854,6 +854,10 @@ cdef class FontProperties(object):
 
     cdef Elm_Font_Properties *efp
 
+    def __dealloc__(self):
+        elm_font_properties_free(self.efp)
+        self.efp = NULL
+
     property name:
         """:type: unicode"""
         def __set__(self, value):
@@ -1045,9 +1049,13 @@ def font_properties_free(FontProperties fp):
 
     .. versionadded:: 1.8
 
+    .. versionchanged:: 1.19
+
+        Changed to no-op as we now do the free automatically when there are
+        no more references to the FontProperties object
+
     """
-    elm_font_properties_free(fp.efp)
-    Py_DECREF(fp)
+    pass
 
 def font_fontconfig_name_get(font_name, style = None):
     """Translate a font name, bound to a style, into fontconfig's font names

-- 


Reply via email to