Hi all:
I’m using gdbus_codegen to generate bindings for a DBus server. The point is that I followed the examples I found (mainly in the official documentation) and I think that I found a memory bug. I have this piece of code:
static void
dbus_handle_method (MyObject *skeleton,
GDBusMethodInvocation *invocation,
gchar *fileName,
gchar *lockFilePath,
GVariantIter *extraParams,
gpointer data) {
handle_application_is_being_refreshed(fileName, lockFilePath, extraParams, data);
my_object_complete_method(skeleton, invocation);
}
With this code, valgrind shows an access-after-free bug, triggered after this function call has ended; but changing the last line into
my_object_complete_method(skeleton, g_object_ref(invocation));
seems to fix it, because Valgrind shows no error and no extra leaks when the program exists, no matter how many times I called the method.
So… is this a bug in GDBus, in the documentation, or am I doing something wrong?
Thanks.