summaryrefslogtreecommitdiff
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
parentd87e0a5484d7a025921ec06791c57a4941af7004 (diff)
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):
854 854
855 cdef Elm_Font_Properties *efp 855 cdef Elm_Font_Properties *efp
856 856
857 def __dealloc__(self):
858 elm_font_properties_free(self.efp)
859 self.efp = NULL
860
857 property name: 861 property name:
858 """:type: unicode""" 862 """:type: unicode"""
859 def __set__(self, value): 863 def __set__(self, value):
@@ -1045,9 +1049,13 @@ def font_properties_free(FontProperties fp):
1045 1049
1046 .. versionadded:: 1.8 1050 .. versionadded:: 1.8
1047 1051
1052 .. versionchanged:: 1.19
1053
1054 Changed to no-op as we now do the free automatically when there are
1055 no more references to the FontProperties object
1056
1048 """ 1057 """
1049 elm_font_properties_free(fp.efp) 1058 pass
1050 Py_DECREF(fp)
1051 1059
1052def font_fontconfig_name_get(font_name, style = None): 1060def font_fontconfig_name_get(font_name, style = None):
1053 """Translate a font name, bound to a style, into fontconfig's font names 1061 """Translate a font name, bound to a style, into fontconfig's font names