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 688901 - gstreamer-0.10; GstDebugCategory initialization translated bad in C code
gstreamer-0.10; GstDebugCategory initialization translated bad in C code
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
0.18.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on: 793417
Blocks:
 
 
Reported: 2012-11-22 22:08 UTC by andreas.fenkart
Modified: 2018-05-22 14:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Intialize GstDebugCategory (299 bytes, text/x-vala)
2012-11-22 22:08 UTC, andreas.fenkart
  Details
gstreamer-0.10: declare GstDebugCategory as struct (4.99 KB, patch)
2012-11-24 18:17 UTC, andreas.fenkart
none Details | Review

Description andreas.fenkart 2012-11-22 22:08:34 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
Comment 1 andreas.fenkart 2012-11-23 14:26:14 UTC
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;
        }
Comment 2 Luca Bruno 2012-11-23 14:29:59 UTC
It's not a regression. As said, DebugCategory must be a struct not a class to work. Like in gstreamer-1.0.
Comment 3 andreas.fenkart 2012-11-24 18:15:38 UTC
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.
Comment 4 andreas.fenkart 2012-11-24 18:17:13 UTC
Created attachment 229779 [details] [review]
gstreamer-0.10: declare GstDebugCategory as struct
Comment 5 GNOME Infrastructure Team 2018-05-22 14:37:21 UTC
-- 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.