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

Havoc Pennington hp at redhat.com
Thu Aug 24 11:51:41 PDT 2006


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().

Havoc


More information about the dbus mailing list