【发布时间】:2011-04-14 08:03:07
【问题描述】:
不能请人告诉我为什么下面的代码在执行时会崩溃,(编译正常)它在向左旋转 90 度的 X 环境中。
DBusGConnection *connection;
DBusGProxy *proxy;
GError *error = NULL;
gchar *name = NULL;
g_type_init ();
//Get the connection and ensure the name is not used yet
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (connection == NULL) {
g_warning ("Failed to make connection to system bus: %s",
error->message);
g_error_free (error);
exit(1);
}
proxy = dbus_g_proxy_new_for_name (connection,
"to.some.Service",
"/to/some/Object",
"to.some.Interface" );
dbus_g_proxy_call(proxy, "getStatus", &error, G_TYPE_INVALID, G_TYPE_STRING, &name, G_TYPE_INVALID);
printf("Name is: %s\n", name);
return 0;
【问题讨论】:
-
如果它真的只是在显示器旋转 90 度时崩溃,我很确定它与您调用的确切服务有关。请说明它是什么服务。
-
该服务由我定义,我认为它工作正常,因为我编写了一个返回正确值的模拟 python 脚本(与上面的脚本相同)。
-
其实上面的代码在X的第一次启动时运行正常。但是如果显示器的方向旋转则无法正常运行。
-
被否决,因为问题特定于您的代码,对其他人通常没有用处。