-1

以下のコードが実行時にクラッシュする理由を教えてください (コンパイルは問題ありません)。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;
4

1 に答える 1

0

答えが出ました。実際、サービスは Python で実行されており、戻り値は文字列ではありませんでした。Python では強い型ではないためです。したがって、 str(status) を返しますが、ステータスはありません。私の問題は解決しました。

于 2010-09-19T14:20:13.350 に答える