[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Surfarray.array_alpha() bugfix, py2exe/py2app segfault



René Dudfield wrote:
On Tue, Feb 3, 2009 at 7:11 PM, Marcus von Appen <mva@xxxxxxxxxxxx> wrote:
On, Tue Feb 03, 2009, Lenard Lindstrom wrote:
[cut]
Well, for starters the buffer proxy object only borrows a reference to
its parent surface (no PY_INCREF/PY_DECREF calls).
Which should be absolutely okay, as surface.get_buffer() acquires a
lock.


hrmm... I think it could matter if the parent surface gets to
reference count 0 -- when the buffer still exists, and then the
surface tries to deallocate the parent surface memory... thus making
the buffer point to invalid memory.

?
No, Marcus is right. I missed the whole lifetime lock thing. The buffer proxy does acquire a new reference to its parent surface via the lock object. But in verifying this I did find a potential memory leak in surflock's PySurface_LockLifetime, unrelated to the problem at hand though. Otherwise reference counting looks to be in order. That leaves _numpysurfarray.py.

Lenard

--
Lenard Lindstrom
<len-l@xxxxxxxxx>