Closed GoogleCodeExporter closed 9 years ago
Since the problem seems to be in FT_Done_FreeType, I started to look for that.
It's called in the destructor, which we attach manually. Revision d007363b922a
changed this from being done directly on the library to being handled by the
wrapper. My bet is that things aren't being destroyed in the expected order,
and this is somehow causing the seg fault. (In my limited experience with
Python destructors, they're never called when I expect them to be.)
Reverting that bit of code back to something more like the previous version
fixes the problem for me. I've attached a patch. I really don't know what I'm
doing here, so I'd like you to take a look over it before I push.
Original comment by rschr...@gmail.com
on 2 Aug 2012 at 2:59
Attachments:
I hadnt tested on Linux yet. I get a segfault too. I dove into this a bit
deeper and tried a couple of different approaches to do the FT_Done_FreeType
call.
I'm a bit confused, because I know think that with the non-segfaulting
appraches, it is simply never called. I tested this by creating a dummy file in
the destructor, but you can also see this from the code:
def __del_library__(self):
global __handle__
if __handle__:
try:
FT_Done_FreeType(byref(self))
__handle__ = None
except:
pass
FT_Library.__del__ = __del_library__
__handle__ is the singleton instance of FT_Library. The __del__ can never
execute, because it needs a reference to __handle__, which is ... the object
that we want to destroy itself!
Arg! But not-calling FT_Done_FreeType seems wrong too...
Original comment by almar.klein@gmail.com
on 2 Aug 2012 at 8:31
I phrased that wrong. The __del__ *can* execute, but in that case __handle__
will already have been set to None by the Python cleanup thingy.
In some other approaches it seems that the __del__ is simply never executed
though.
Original comment by almar.klein@gmail.com
on 2 Aug 2012 at 8:36
Found it. It should be "self._dll.FT_Done_FreeType(self._handle)"
not "self._dll.FT_Done_FreeType( byref(self._handle) )"
Will notify Nicolas about this bug.
Original comment by almar.klein@gmail.com
on 2 Aug 2012 at 9:06
This issue was closed by revision dd74eba20b41.
Original comment by almar.klein@gmail.com
on 2 Aug 2012 at 9:06
Original issue reported on code.google.com by
rschr...@gmail.com
on 2 Aug 2012 at 2:11