-1
不能請別人告訴我爲什麼下面的代碼在執行時崩潰,(編譯成功)它在旋轉的X環境90左邊。C DBus:調用方法返回字符串時失敗
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度時崩潰,我很確定它與您打電話的確切服務有關。請說明它是哪種服務。 – 2010-09-19 13:29:11
該服務由我定義,我認爲它的工作正常,因爲我寫了一個模擬python腳本(與上面的腳本相同),它返回了正確的值。 – deimus 2010-09-19 13:44:31
實際上面的代碼在X的第一次啓動時工作正常,但如果旋轉顯示的方向,則無法正常運行。 – deimus 2010-09-19 13:45:20