[C++-sig] call_method

Brett Calcott brett.calcott at paradise.net.nz
Sat Nov 9 12:59:34 CET 2002


I spoke to soon. It seems that it works *sometimes*. Other times it crashes
and returns with a C++ exception. There seems to be some corruption going on
as I get some strange results.

This is what happens.
I have a base type and a derived type which calls back to python.
I have a vector of base type shared pointers.
In python I put a few python subclassed types into the vector.
I then get them out and try to call the virtual function in them.
The first one I get out works, it actually makes it to the python callback
code.
The next one returns with a C++ runtime exception error
Debugging the code it looks as if the m_self member that is held in the
callback class has been deleted - causing the crash.

I have included the code (which is very grubby). Let me know if you need
more.

Apologies that I can't find this myself. I get lost pretty fast in amongst
the templates and preprocessor stuff.

Cheers,
Brett

ps. I tried this with both the project build dll and the bjam one.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.py
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021110/bc8a57ae/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pch.h
Type: application/octet-stream
Size: 880 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021110/bc8a57ae/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: application/octet-stream
Size: 2191 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021110/bc8a57ae/attachment-0001.obj>


More information about the Cplusplus-sig mailing list