Boost logo

Boost :

From: Dave Deakins (ddeakins_at_[hidden])
Date: 2004-09-23 22:28:16


"Doug Gregor" <dgregor_at_[hidden]> wrote in message
news:D5FEB638-0DB1-11D9-A949-000D932B7224_at_cs.indiana.edu...
> On Sep 5, 2004, at 5:51 PM, Dave Deakins wrote:
>
> > ...should there be a:
> >
> > watch_bound_objects.set_controlling();
> >
> > statement at the very end of the slot_base::create_connection()
> > procedure
> > (after the safe_connection.release() statement) in slot.cpp?
>
> I don't think that's the right solution, because watch_bound_objects
> gets copied around a bit, and would then disconnect too early. I'm
> revisiting this code now to try to isolate the bug.
>

I agree. After trying out that idea, I noticed exactly what you said. It
did indeed cause slots to disconnect prematurely. However, what if you made
watch_bound_objects a shared_ptr<connection> instead of a just a connection?
In that case, you could still set it as controlling at the end of
create_connection, but the connection wouldn't be destroyed unless all
copies of the slot ceased to exist. It seems like that would work to clean
up the slot/trackable references at the proper time, but maybe there is a
more elegant solution than that.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk