Re: refcount checking in add_interface



Darin Adler <darin@eazel.com> writes:

> on 3/29/00 4:16 AM, Nat Friedman at nat@helixcode.com wrote:
> 
> It's slightly worse than that!
> 
> If we want to make add_interface work in the case where the two ref counts
> are not both == 1, by adding a more-correct check (like the hash table thing
> you suggested above), we have to add a bit of code to look at the ref
> counts. The current code just drops one of the tow ref counts on the floor.
> This is only OK if it's known to be == 1.

This is actually a bug in the code as it is now, because
query_local_interface() refs, so if you query_local_interface
something before add_interface()ing it to something else (which, IMO,
is a perfectly valid operation), refs get lost.

In fact, query_local_interface ref'ing is a further problem, because
if you query_local_interface, keep a copy around, and expect to unref
in your destroy method, the object will never get destroyed solely
through remote references being dropped. Perhaps we need a specific
remote refcount and a combined refcount. Or maybe
query_local_interface should not ref.

 - Maciej



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]