Re: [C++-sig] Retaining a useful weak_ptr to a wrapped C++ interface implemented in Python

2012-03-06 Thread Adam Preble
Do have a way to unregister the callback? When I was using a shared_ptr originally, I was trying to use that, yet the objects still hung around. I was thinking that I properly didn't completely unregister it from all listeners, but I wonder now if I actually managed to cover all my tracks. I'm w

Re: [C++-sig] Retaining a useful weak_ptr to a wrapped C++ interface implemented in Python

2012-03-06 Thread Holger Brandsmeier
Adam, >> So, before the function exits your object `arg` exists at least in three >> places: >>  1) somewhere in C++ where it was created >>  2) in the python context >>  3) in the context of addCallback >> > > Technically, it was declared and constructed from Python, but everything you > say is a

Re: [C++-sig] Retaining a useful weak_ptr to a wrapped C++ interface implemented in Python

2012-03-06 Thread Adam Preble
On Tue, Mar 6, 2012 at 3:47 AM, Holger Brandsmeier wrote: > Adam, > > You probably have a function like this > > void addCallback(share_ptr<> arg) { > callbacks.push_back(weak_ptr<>(arg); > } > > That's pretty much what I have happening. > > So, before the function exits your object `arg` exists

Re: [C++-sig] Retaining a useful weak_ptr to a wrapped C++ interface implemented in Python

2012-03-06 Thread Holger Brandsmeier
Adam, you probably run into a similar problem that I ran into (not with boost::shared_ptr but with our custom implementation which strongly mimics boost::shared_ptr). I wanted to have a class in C++ that is extended in python, and it should store a weak_ptr to itself. Unfortunately I didn't solve