I don't think maxdict is the problem though it may be changing how the problem manifests itself. What is happening is that when maxdict is used, those C++ extension objects are deleted after the first 50 math expressions. When using a dict, they aren't deleted until closing the application, so it just delays the problem.
All that said, I'm not sure as to the real cause of the error.
I was able to reproduce it on Windows XP with:
mpl 0.98.5, wx 18.104.22.168, python 2.5.4
however, the following seems to work:
mpl 0.98.5, wx 22.214.171.124, python 2.6.3
Are you able to update to Python 2.6? That might be one solution to the problem.
I have to say I'm completely stumped as to the root cause of this one.
On 10/17/2009 08:44 AM, C�drick FAURY wrote:
I restate the problem :
With the attached script "test_mathtext_wx.py" :
50 functions (line 31) : the 50 bitmaps are generated correctly, by when I close the application an error appears in the console :
Assertion failed: ob_refcnt == 0, file CXX\cxx_extensions.cxx, line 1128
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
250 functions : the window never appears and the crash occurs (same message)
However, if in mathtext.py (mpl 0.98.5 win32 py2.5) line 2765 in MathTextParser, I put "self._cache = dict()" instead of "self._cache = maxdict(50)", the behavior of "test_mathtext_wx.py" is significantly different.
50 functions : error on console after closing the application (no difference here)
250 functions : NO CRASH (but error after closing the application)
And now, my questions :
Is this proof that "maxdict" is the cause of the problem ?
Is there a known way to avoid the problem?
Can someone tell me more about maxdict ?
Hoping to have been quite clear,