Segmentation fault when using va_list

Colin Walters walters at verbum.org
Tue Dec 23 10:26:18 PST 2008


On Tue, Dec 23, 2008 at 7:21 AM, Priya Raghavendra
<Priya_Raghavendra at mindtree.com> wrote:
> Hi,
>
>
>
> I am a newbie to DBUS. I am trying to create a signal which takes va_list as
> its arguments.
>
>
>
> But the program crashes with "Segmentation Fault" when I execute this code.

I don't see anything obviously wrong in the code sample in a quick
look.  One common error is to not pass arguments by reference.  For
example, this is incorrect:
const char *text = "hello";
int val = 42;
dbus_message_append_args (msg, DBUS_TYPE_INT32, val, DBUS_TYPE_STRING,
text, DBUS_TYPE_INVALID);

This is correct:
int val = 42;
const char *text = "hello";
dbus_message_append_args (msg, DBUS_TYPE_INT32, &val,
DBUS_TYPE_STRING, &text, DBUS_TYPE_INVALID);


More information about the dbus mailing list