After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 640878 - g_object_set() for a plug-in property
g_object_set() for a plug-in property
Status: RESOLVED INVALID
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-29 02:35 UTC by Ranjit
Modified: 2011-01-29 18:08 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ranjit 2011-01-29 02:35:14 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?
Comment 1 Thiago Sousa Santos 2011-01-29 04:13:14 UTC
Try:

g_object_set(G_OBJECT(plugin), "property1", G_GINT64_CONSTANT (451260000), NULL);
Comment 2 Tim-Philipp Müller 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?

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!