GNOME Bugzilla – Bug 640878
g_object_set() for a plug-in property
Last modified: 2011-01-29 18:08:15 UTC
the below statement throws a warning: g_object_set(G_OBJECT(plugin), "property1", 451260000, NULL); and the warning is: GLib-GObject-WARNING **: IA__g_object_set_valist: object class `plugin' has no property named "<_my_function_name>" ------------------------------------------------------...... if it is tried as below, it works gint64 max = 451260000; g_object_set(G_OBJECT(plugin), "property1", max, NULL); why this happens?
Try: g_object_set(G_OBJECT(plugin), "property1", G_GINT64_CONSTANT (451260000), NULL);
> the below statement throws a warning: > g_object_set(G_OBJECT(plugin), "property1", 451260000, NULL); > > and the warning is: > GLib-GObject-WARNING **: IA__g_object_set_valist: object class `plugin' > has no property named "<_my_function_name>" > > ------------------------------------------------------...... > if it is tried as below, it works > gint64 max = 451260000; > g_object_set(G_OBJECT(plugin), "property1", max, NULL); > > why this happens? Because g_object_set() is a vararg function that expects the parameters passed to be exactly of the type that the property is. The compiler doesn't know in this case that 451260000 is supposed to be a 64-bit integer, and will hence just pass a normal integer, which means that parsing will be messed up and the NULL terminator won't be recognised properly, so it'll just continue looking for arguments. You're lucky that you just get that warning and not a crash. This is not a bug, closing. If you have further questions, please ask on the mailing list, thanks!