<br><div class="gmail_quote">On Sat, Feb 4, 2012 at 8:48 PM, Jim Bosch <span dir="ltr"><<a href="mailto:talljimbo@gmail.com">talljimbo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Oh, you're right. I was confusing the manual way of doing Python-side polymorphism (derived-class holders) with the more automatic (and better) way you're doing it (with wrapper). Your original code was fine in that regard.</div>
<br>
Anyhow, looking closer, here's what you need to do:<br>
<br>
- Put your code back to what it was before I told you to change it.<br>
<br>
- Add another line, after the class wrappers:<br>
<br>
register_ptr_to_python< boost::shared_ptr<<u></u>Communicatable> >();<br>
<br>
That explicitly registers a shared_ptr converter for Communicatable. I'm not sure why Boost.Python doesn't automatically do that when you register converters for its derived classes (those are registered by putting the shared_pr types in the template parameters to class_). It might just be an oversight, or it might be that doing the base class registration automatically would cause problems in some contexts.<div class="HOEnZb">
<div class="h5"><br><br></div></div></blockquote><div>The appears to do the trick. I'm wondering--how do you figure out stuff like that? That isn't the kind of thing that could have just occurred to me. </div><div>
<br></div><div>This little test program works, but so far I haven't resolved the crash in my more complicated code that's coming a Python subclass of a C class trying to get a callback from Python instance of a C class . . . it's rough even explaining it. I'll have to review my code and make sure I'm doing that in all the right places. Either I get it working because of these little things here, or I'll be back with a modification of this source to show the problem with shared_ptr conversion that I was seeing.</div>
</div>