我在DBUS初始化时随机获得dbus断言和应用程序崩溃。
下面是我的代码片段来获取dbus。
px_sess_ctxt->px_bus = dbus_g_bus_get (DBUS_BUS_SESSION, &ppx_error);
if (NULL == px_sess_ctxt->px_bus)
{
return ERROR_1;
}
px_bus_proxy = dbus_g_proxy_new_for_name (px_sess_ctxt->px_bus,
PROXY_NAME, PROXY_PATH,PROXY_INTERFACE_NAME);
if (NULL == px_bus_proxy)
{
return ERROR_2;
}
dbus_g_proxy_call (px_bus_proxy, "pingMethod", &ppx_error,
G_TYPE_STRING, svc_name,G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &ui_ret, G_TYPE_INVALID);
随机我得到分段现金,然后dbus_g_proxy_call()失败。下面是代理调用失败时得到的错误。
process 1559: arguments to dbus_pending_call_steal_reply() were incorrect, assertion "pending->reply != NULL" failed in file dbus-pending-call.c line 715.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
请让我们知道dbus-glib库中遇到的任何问题。这将非常有帮助。
谢谢
正如您所发现的那样,dbus-glib客户端绑定到D-Bus很难使用。它们已被弃用且未维护,强烈建议您不要使用它们。
有关要使用的备用客户端绑定的讨论,请参阅this question。如果您已经在项目中使用了GLib,那么GDBus(GIO的一部分,它是GLib的一部分)是显而易见的选择。