Problem emitting signal with GVariant constructed from unit tuple

Bogdan Lotko boguslaw.lotko at chello.at
Wed Jul 9 04:23:27 PDT 2014


Hello,

I have a problem with emitting of the following signal:

    <signal name="mySignal">
       <arg type="s" name="paramName" direction="out"/>
       <arg type="s" name="group" direction="out"/>
       <arg type="v" name="paramDetails" direction="out"/>
     </signal>

the code (myInterface_if_emit_my_signal) has been generated with 
gdbus-codegen ( glib-2.32.0 )

I am working on SLES 11.

Following source code illustrates the problem

...
GVariant *arr[GVARIANT_GEN_SIZE];
int cnt = 0;

if( *condition*)
{
   arr[cnt++] = g_variant_new_boolean( aBoolValue );
   ....
   arr[cnt++] = g_variant_new_xxx( xxxValue );
}

GVariant *gv = g_variant_new_variant( g_variant_new_tuple(arr, cnt) );

myInterface_if_emit_my_signal( "string1", "string2", gv );
....

As long as the *condition* is true, everything works perfectly.

In case that the *condition* is false, the unit tuple shall be 
constructed (cnt == 0) - the g-variant-new-tuple description states:
"If /|n_children|/ is 0 then the unit tuple is constructed"

Emitting the signal with such a unit tuple causes the application crash.

Is this a "feature", bug or my mistake? How to resolve this?

thank you for your help,

with best regards

-- 

*Bogdan Lotko*

b.lotko at chello.at
Phone: +43 1 2852458
Mobile: +43 676 6615012
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20140709/f47f6239/attachment.html>


More information about the dbus mailing list