New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
agg_buffer_to_array.py crashes #1437
Conversation
Do you happen to know if this is Numpy version specific? |
It does not seem numpy version specific. The same crash happens with numpy-1.5.1. |
Reproduced on Linux. Looking into it now... |
This example really will only ever work with a non-GUI backend. What's happening is that an array is created around the image buffer and then the associated window is resized, deleting that buffer and creating a new one. There was a:
at the top of this example that was erroneously removed by me in 31a428c. Unless there's a good reason to make this work with GUIs, I suggest we put that line back in. Otherwise, the |
@mdboom Does adding that line back in fix the problem? If so, I'm curious as to why that's the case. |
Adding the line back in does resolve the problem. An alternative is @cgohlke's original suggestion of copying the data. I think I'm leaning toward @cgohlke's suggestion because, while less efficient, will work in more contexts and is less surprising. |
Fix attached. Can you confirm it works, and then we'll merge. |
That will only work for Python 2. Python 3 fails with |
Thanks. I have updated this with that approach. |
Looks good. Will merge tomorrow. |
agg_buffer_to_array.py crashes
On Python 2.x for Windows, using matplotlib 1.2.0 (any rc build) with the TkAgg backend, the agg_buffer_to_array.py crashes reproducibly. Python 3.x and other backends (Qt4Agg, FltkAgg, wxAgg) seem to work OK.
The faulthandler traceback is:
The crash happens at line 198 of image.py:
Any access to the data of
self._A
, such asself._A[0,0,0]
, triggers a crash. The shape and dtype ofself._A
are correct.Changing line 15 of agg_buffer_to_array.py from
to
seems to fix this crash.