GNOME Bugzilla – Bug 780903
Fails to build with -Werror against glib master, use of deprecated g_object_newv()
Last modified: 2017-04-08 09:29:34 UTC
The nightly git master flatpak build fails: http://sdkbuilder1.gnome.org//logs/build-2017-04-04-135003/build-gnome-sdk-images-master-x86_64.txt with: gstbufferpool.c: In function ‘gst_buffer_pool_new’: gstbufferpool.c:222:3: error: ‘g_object_newv’ is deprecated: Use 'g_object_new_with_properties' instead [-Werror=deprecated-declarations] result = g_object_newv (GST_TYPE_BUFFER_POOL, 0, NULL); ^~~~~~ In file included from /usr/include/glib-2.0/gobject/gbinding.h:29:0, from /usr/include/glib-2.0/glib-object.h:23, from ../gst/gstobject.h:29, from ../gst/gstplugin.h:29, from gstregistry.h:28, from gst_private.h:45, from gstbufferpool.c:67: /usr/include/glib-2.0/gobject/gobject.h:429:10: note: declared here gpointer g_object_newv (GType object_type, ^~~~~~~~~~~~~ cc1: all warnings being treated as errors make[4]: *** [Makefile:1149: libgstreamer_1.0_la-gstbufferpool.lo] Error 1 make[4]: *** Waiting for unfinished jobs....
Should we just remove the the -DG_DISABLE_DEPRECATED until we move to glib 2.52 in a year or two?
No, as usual we put there: #if GLIB_CHECK_VERSION(2,52,0) ... code with new function #else ... old code #endif And once we switch we can directly switch over the code without having to actually port lots of places at the same time.
We can just switch to g_object_new() or add a compat macro for the new API guarded by a glib check into gst_private.h
Created attachment 349253 [details] [review] Don't use deprecated g_object_newv() Use g_object_new() instead which nowadays has a shortcut for the no-properties check. It still does an extra GType in the function guard, but there's a pending patch to remove that and it's hardly going to be a performance issue in practice, even less so on a system that's compiled without run-time checks. Alternative would be to move to the new g_object_new_properties() with a fallback define for older glib versions, but it makes the code look more unwieldy and doesn't seem worth it. Fixes deprecation warnings when building against newer GLib versions. https://bugzilla.gnome.org/show_bug.cgi?id=780903 For duplicate type check removal see bug #780908.
commit 519d64881fad234c9a637c0c1bcc3d8155e46b3f Author: Tim-Philipp Müller <tim@centricular.com> Date: Tue Apr 4 17:53:39 2017 +0100 Don't use deprecated g_object_newv() Use g_object_new() instead which nowadays has a shortcut for the no-properties check. It still does an extra GType check in the function guard, but there's a pending patch to remove that and it's hardly going to be a performance issue in practice, even less so on a system that's compiled without run-time checks. Alternative would be to move to the new g_object_new_properties() with a fallback define for older glib versions, but it makes the code look more unwieldy and doesn't seem worth it. Fixes deprecation warnings when building against newer GLib versions. https://bugzilla.gnome.org/show_bug.cgi?id=780903