On Mi, 2011-12-14 at 16:52 +0100, Chris Kühl wrote:
> I just looked but don't see anything. If you are referring to setting
> up a peer-to-peer dbus connection, that's done using the (G)DBusServer
> class. There is an example at [1].

I have that same example working based on GDBus + libdbus. What I don't
like about it is that the connection is based on listen() + connect().
This makes it harder for the parent to detect that the child died: if
the parent did the usual trick (create socket pair, fork+exec child,
close its own side of the socket pair), then a closed socket would
indicate that the child died. With listen() + connect() it has to check
for existence of the child periodically. SIGCHILD does not integrate
into the main loop well, but I see that g_spawn() has a GChildWatch -
that should do.

While working on this I got unhappy with some aspects of the current
D-Bus C++ wrapper. The result is the "dbus-cleanup" branch. Chris, what
do you think about that? Note that your example code closed the
connection while the rest of SyncEvolution didn't. This might be
something that still needs to be fixed.

While testing that with GDBus GIO I noticed that I get segfaults when
compiling on Debian Testing and --with-gio-dbus. That happens with and
without my clean up patches - Chris, can you check that? If you cannot
reproduce it, then please let me know and I will check it. It's a bit
strange that I haven't seen that in the nightly testing.

The signal callback seems to get an invalid std::string:

0x00007ffff24c479b in std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::basic_string(std::string const&) () from 
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) where
#0  0x00007ffff24c479b in std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::basic_string(std::string const&) () from 
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00000000006e0d11 in __gnu_cxx::new_allocator<std::string>::construct 
(this=0x7fffffffdf08, __p=0xe28550, 
    __val=...) at /usr/include/c++/4.6/ext/new_allocator.h:108
#2  0x00000000006e0e95 in std::vector<std::string, std::allocator<std::string> 
>::_M_insert_aux (
    this=0x7fffffffdf08, __position=..., __x=...) at 
/usr/include/c++/4.6/bits/vector.tcc:335
#3  0x00000000006db20c in std::vector<std::string, std::allocator<std::string> 
>::push_back (this=0x7fffffffdf08, 
    __x=...) at /usr/include/c++/4.6/bits/stl_vector.h:834
#4  0x00000000006d3ee6 in SyncEvo::RemoteDBusServer::updateSessions 
(this=0x7fffffffdec0, session=..., active=true)
    at /home/pohly/syncevolution/syncevolution/src/syncevolution.cpp:956
#5  0x00000000006d26b0 in SyncEvo::RemoteDBusServer::sessionChangedCb 
(this=0x7fffffffdec0, object=..., active=true)
    at /home/pohly/syncevolution/syncevolution/src/syncevolution.cpp:720
#6  0x00000000006f170b in boost::_mfi::mf2<void, SyncEvo::RemoteDBusServer, 
GDBusCXX::DBusObject_t const&, bool>::operator() (this=0x7fffffffdf78, 
p=0x7fffffffdec0, a1=..., a2=true) at 
/usr/include/boost/bind/mem_fn_template.hpp:280
#7  0x00000000006ef722 in 
boost::_bi::list3<boost::_bi::value<SyncEvo::RemoteDBusServer*>, boost::arg<1>, 
boost::arg<2> >::operator()<boost::_mfi::mf2<void, SyncEvo::RemoteDBusServer, 
GDBusCXX::DBusObject_t const&, bool>, boost::_bi::list2<GDBusCXX::DBusObject_t 
const&, bool const&> > (this=0x7fffffffdf88, f=..., a=...)
    at /usr/include/boost/bind/bind.hpp:392
#8  0x00000000006ecf74 in boost::_bi::bind_t<void, boost::_mfi::mf2<void, 
SyncEvo::RemoteDBusServer, GDBusCXX::DBusObject_t const&, bool>, 
boost::_bi::list3<boost::_bi::value<SyncEvo::RemoteDBusServer*>, boost::arg<1>, 
boost::arg<2> > >::operator()<GDBusCXX::DBusObject_t, bool> 
(this=0x7fffffffdf78, a1=..., a2=@0x7fffffffd5df: true)
    at /usr/include/boost/bind/bind_template.hpp:102
#9  0x00000000006ea742 in 
boost::detail::function::void_function_obj_invoker2<boost::_bi::bind_t<void, 
boost::_mfi::mf2<void, SyncEvo::RemoteDBusServer, GDBusCXX::DBusObject_t 
const&, bool>, boost::_bi::list3<boost::_bi::value<SyncEvo---Type <return> to 
continue, or q <return> to quit---
::RemoteDBusServer*>, boost::arg<1>, boost::arg<2> > >, void, 
GDBusCXX::DBusObject_t const&, bool const&>::invoke (
    function_obj_ptr=..., a0=..., a1=@0x7fffffffd5df: true) at 
/usr/include/boost/function/function_template.hpp:153
#10 0x00000000006e5db4 in boost::function2<void, GDBusCXX::DBusObject_t const&, 
bool const&>::operator() (
    this=0x7fffffffdf70, a0=..., a1=@0x7fffffffd5df: true) at 
/usr/include/boost/function/function_template.hpp:1013
#11 0x00000000006def3b in GDBusCXX::SignalWatch2<GDBusCXX::DBusObject_t, 
bool>::internalCallback (conn=0xe1b810, 
    sender=0x7fffe80011c0 ":1.534", path=0x7fffe8000ee0 
"/org/syncevolution/Server", 
    interface=0x7fffe8000af0 "org.syncevolution.Server", signal=0x7fffe80010a0 
"SessionChanged", params=0xe2ab00, 
    data=0x7fffffffdf58) at 
/home/pohly/syncevolution/syncevolution/src/gdbusxx/gdbus-cxx-bridge.h:4221
#12 0x00007ffff33299ae in emit_signal_instance_in_idle_cb (data=0x7fffe8002330)
    at /tmp/buildd/glib2.0-2.30.2/./gio/gdbusconnection.c:3613
#13 0x00007ffff276c0cf in g_main_dispatch (context=0xe16670) at 
/tmp/buildd/glib2.0-2.30.2/./glib/gmain.c:2442
#14 g_main_context_dispatch (context=0xe16670) at 
/tmp/buildd/glib2.0-2.30.2/./glib/gmain.c:2998
#15 0x00007ffff276c8c8 in g_main_context_iterate (context=0xe16670, 
block=<optimized out>, dispatch=1, 
    self=<optimized out>) at /tmp/buildd/glib2.0-2.30.2/./glib/gmain.c:3076
#16 0x00007ffff276ce02 in g_main_loop_run (loop=0xe16540) at 
/tmp/buildd/glib2.0-2.30.2/./glib/gmain.c:3284
#17 0x00000000006d296b in SyncEvo::RemoteDBusServer::execute 
(this=0x7fffffffdec0, args=..., peer=..., 
    runSync=false) at 
/home/pohly/syncevolution/syncevolution/src/syncevolution.cpp:773
#18 0x00000000006d1254 in SyncEvo::main (argc=2, argv=0x7fffffffe228)
    at /home/pohly/syncevolution/syncevolution/src/syncevolution.cpp:549
(gdb) up 4
#4  0x00000000006d3ee6 in SyncEvo::RemoteDBusServer::updateSessions 
(this=0x7fffffffdec0, session=..., active=true)
    at /home/pohly/syncevolution/syncevolution/src/syncevolution.cpp:956
956             m_activeSessions.push_back(session);
(gdb) p session
$1 = (const std::string &) @0x7fffffffd5e0: {static npos = <optimized out>, 
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = 
{<No data fields>}, <No data fields>}, _M_p = 0x0}}

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.


_______________________________________________
SyncEvolution mailing list
SyncEvolution@syncevolution.org
http://lists.syncevolution.org/listinfo/syncevolution

Reply via email to