0

I want to create a tuple of array of dictionary to pass argument to method RequestScan (IN a{sv} options). I write code as below.

/* Create empty dictionary */
GVariantBuilder *b;
GVariant *option;
b = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
option = g_variant_builder_end (b);

/* Start to scan */
dbusRet = g_dbus_proxy_call_sync(wIfProxy, 
                                "RequestScan", 
                                g_variant_new("(a{sv})", option),
                                G_DBUS_CALL_FLAGS_NONE, 
                                -1, 
                                NULL, 
                                &error);

I can build the code, but when run program it output error as below.

(process:35140): GLib-CRITICAL **: 21:45:35.337: g_variant_builder_end: assertion 'ensure_valid_builder (builder)' failed

(process:35140): GLib-CRITICAL **: 21:45:35.337: g_variant_get_type: assertion 'value != NULL' failed

(process:35140): GLib-CRITICAL **: 21:45:35.337: g_variant_type_is_array: assertion 'g_variant_type_check (type)' failed

(process:35140): GLib-CRITICAL **: 21:45:35.337: g_variant_get_type_string: assertion 'value != NULL' failed

(process:35140): GLib-ERROR **: 21:45:35.337: g_variant_new: expected array GVariantBuilder but the built value has type '(null)'

Could you tell me what is the error in the implementation?

0 Answers0