Bug 8655

Summary: dbus_connection_unregister_object_path segfaults
Product: dbus Reporter: Daniel Stone <daniel>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED NOTOURBUG QA Contact: John (J5) Palmieri <johnp>
Severity: critical    
Priority: high    
Version: unspecified   
Hardware: All   
OS: All   
URL: http://people.freedesktop.org/~daniels/dbus-testcase.c
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 7813    

Description Daniel Stone 2006-10-16 01:40:49 UTC
As the subject says.  In the testcase (basically copy and pasted from the
current X server D-BUS code), you'll see 'about to init' printed, then 'about to
finish', then a segfault.  gdb shows the segfault appears to be in
dbus_connection_unregister_object_path.

Being able to restart the connection is a hard requirement for us.  I have no
idea if it otherwise works (apparently _close is not what I want, and instead I
need to unref the connection), because we can't register the same path again.
Comment 1 Havoc Pennington 2006-10-16 08:34:30 UTC
Thanks for the test case, looks like it is supposed to work, so this should be 
pretty simple to debug.

(unrelated, you do want to unref() not close() the result of dbus_bus_get() - 
the docs in latest cvs sources go into some detail on this, but the html docs 
on the web site probably haven't been updated. if you want a connection that 
can be closed, you should use dbus_bus_get_private instead, but that will be 
decidedly more wasteful if other code in the same process also wants to use 
the bus since the connection won't be shared.)
Comment 2 Daniel Stone 2006-10-16 08:41:51 UTC
yeah, i'm unreffing it in most spots, just not all.  thanks for the catch.
Comment 3 John (J5) Palmieri 2006-10-16 13:22:10 UTC
I am happy to report that the issue is not in D-Bus but in how C nulls out
structs (namely it doesn't):

Adding a memset(&vtable, 0, sizeof(vtable)); removes the crash.
Comment 4 Daniel Stone 2006-10-16 13:48:47 UTC
i suck at life.  thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.