aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2017-04-15 16:50:27 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2017-04-15 16:50:27 +0300
commita70c42e6814a5368164e749ff497c215519314a4 (patch)
tree05f189ef20bfbcf8823cf7ffa520514289985b13
parentanother win stack piece (diff)
downloadpython-efl-a70c42e6814a5368164e749ff497c215519314a4.tar.gz
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.
-rw-r--r--efl/elementary/__init__.pyx12
1 files 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