[patch] do not segfault when D-Bus connection is reused

John (J5) Palmieri johnp at redhat.com
Thu Aug 24 12:22:18 PDT 2006


On Thu, 2006-08-24 at 14:51 -0400, Havoc Pennington wrote:
> John (J5) Palmieri wrote:
> > Ya, this fix is not quite right.  You shouldn't be able to close a
> > shared connection.  We should most likely make close print a warning for
> > shared connections.  Why do we have a close and unref in the first
> > place?
> > 
> 
> Well, they have different semantics. close() absolutely requires an 
> "owner" - it's something that inherently can be done only once, and has 
> side effects affecting everyone using the connection. So for any 
> connection, if you want to close() it, you have to be able to say "this 
> part of the code owns whether/when to close it, and nobody else is allowed"
> 
> a reference doesn't require this - there are multiple references, and my 
> references don't have any effect on anyone else. So lots of people can 
> "own a reference" and be guaranteed that the object is in live memory, 
> and be guaranteed that they can unref().

So, if we assume the owner of shared connections is the library and
everything else is the user what do we do if you try to close the shared
connection?  We can't send back errors since that would be an API
change.  Do we warn or do we just go on our merry way?

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list