Re: How to use Gio::DBus::Connection::signal_subscribe?



On Sun, 20 Sep 2015 13:10:37 -0400, Nicolas Jäger wrote:
Hi Christof,

Well yes, sure - the string constructor (that converts from a const
char *) is complaining about the null pointer.

have you try to do :

  Glib::ustring sender;

  ...->signal_subscribe( ..., sender, ... );


or just let the paramater not set,

  ...->signal_subscribe( ..., , ... );

but both of these options would map to empty strings (and therefore
don't work).
did you try ? I can't try, I'm working on something... if that don't work, I have no idea...

Yes, I did try and I then get an assertion because sender wasn't NULL

GLib-GIO-CRITICAL **: g_dbus_connection_signal_subscribe: assertion
'sender == NULL || (g_dbus_is_name (sender) && (connection->flags &
G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION))' failed


Looking at
https://developer.gnome.org/gio/unstable/GDBusConnection.html#g-dbus-connection-signal-subscribe
it should map to a NULL pointer in the C interface, but that doesn't
seem to be possible.

your link point to the unstable doc, are you doing C++ or C ? gtkmm page is :
https://developer.gnome.org/glibmm/stable/classGio_1_1DBus_1_1Connection.html#af981fb48982bce9d4a27f70127df1cb5

you can just compare C API and C++ API.

I am doing C++, but that function in the C++ API is obviously based on
the C API function... Well, the implementation is:

  return g_dbus_connection_signal_subscribe(gobj(), sender.c_str(),
    interface_name.c_str(), member.c_str(), object_path.c_str(), arg0.c_str(),
    static_cast<GDBusSignalFlags>(flags),
    &DBusConnection_Signal_giomm_callback, slot_copy,
    &DBusConnection_Signal_giomm_callback_destroy);

And, of course, the documentation of the C++ API is also based on the
documentation of the C API (except that NULL has been replaced with
0). But the problem is that sender.c_str() can never be NULL (but
that's what I would need to achieve).


Christof

-- 

http://cmeerw.org                              sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org


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