[gst-devel] Possible race-condition when using g_enum_register_static
Michal Benes
michal.benes at itonis.tv
Wed Oct 17 20:32:20 CEST 2007
Hi everybody,
my transcoding pipeline for one video stream and two audio streams
(both decoded by mad plugin) has produced the following warning
GLib-GObject-WARNING **: cannot register existing type
`GstMadEmphasis'
two times and crashed short afterwards. This behavior is not
reproducible. During code review I have found the following code in
gstmad.c
gst_mad_emphasis_get_type (void)
{
static GType mad_emphasis_type = 0;
static GEnumValue mad_emphasis[] = <value omitted>;
if (!mad_emphasis_type) {
mad_emphasis_type = g_enum_register_static ("GstMadEmphasis",
mad_emphasis);
}
return mad_emphasis_type;
}
Isn't this racy when two mad plugins in two separate threads call this
function for the first time? They clearly share the mad_emphasis_type
variable.
The problem is that the code like this is quite common in GStreamer.
Am I wrong or is this a real problem?
Michal
More information about the gstreamer-devel
mailing list