GNOME Bugzilla – Bug 688901
gstreamer-0.10; GstDebugCategory initialization translated bad in C code
Last modified: 2018-05-22 14:37:21 UTC
Created attachment 229684 [details] Intialize GstDebugCategory See attached example source, compile like this valac --pkg gstreamer-0.10 test.vala -C GstDebugCategory is declared in C like this: static GstDebugCategory* vala_plugin_streaming_source_debug = NULL; and initialized in .._base_init() like this: GstDebugCategory* _tmp0_; _tmp0_ = vala_plugin_streaming_source_debug; GST_DEBUG_CATEGORY_INIT (_tmp0_, ... ) This is wrong, because vala_plugin_streaming_source_debug will never be initialized, see: GST_DEBUG_CATEGORY_INIT #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\ if (cat == NULL) \ cat = _gst_debug_category_new (name,color,description); \ }G_STMT_END Instead, vala should pass vala_plugin.._debug pointer directly to GST_DEBUG_CATEGORY_INIT. tested with valac 0.18.0.35-fd2b22
It's a regression, it actually works prio to 0.13.1 breaks with this commit: commit fa176ad5db5fc13291f4ba4c8418170a9593dd69 Author: Luca Bruno <lucabru@src.gnome.org> Date: Wed Jun 15 13:27:21 2011 +0200 codegen: Use temporary variables when accessing a variable Fixes bugs 626038 and 572091. diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala index 2b594db..f3ea02e 100644 --- a/codegen/valaccodememberaccessmodule.vala +++ b/codegen/valaccodememberaccessmodule.vala @@ -699,6 +699,11 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { result.delegate_target_destroy_notify_cvalue = new CCodeConstant ("NULL"); } result.value_type.value_owned = false; + + if (!(variable is Parameter && variable.name == "this") && !(array_type != null && array_type.inline_allocated)) { + result = (GLibValue) store_temp_value (result, variable); + } + return result; }
It's not a regression. As said, DebugCategory must be a struct not a class to work. Like in gstreamer-1.0.
I modified the vapi files so that GstDebugCategory is now a struct, see attached patch. Unfortunately it doesn't change the above problem, still GstDebugCategory is not initialized correctly. You can still apply the patch, after all it seems functional, tested with get_description(), also compiled my plugin after modifying generated C code. FYI: at one I thought it works after applying above patch. But I was mistaken. I made a mistake, after bisecting I jumped back to master, but did not recompile the valac. Hence I used version <0.13 where this problem did not occur, it also explains the large delta in the generated gstreamer-0.10.vapi files.
Created attachment 229779 [details] [review] gstreamer-0.10: declare GstDebugCategory as struct
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/339.