Fixes a bug that was introduced by
2f100782 which made it possible
to set custom stream class IDs.
The stream class is frozen when a stream of its type is instanciated.
However, the trace or writer must still assign a unique ID to the stream
class if none were set prior. This modification moves the stream class
locking (freeze) after the ID assignment check.
Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
stream->id = stream_class->next_stream_id++;
stream->stream_class = stream_class;
bt_ctf_stream_class_get(stream_class);
- bt_ctf_stream_class_freeze(stream_class);
stream->events = g_ptr_array_new_with_free_func(
(GDestroyNotify) bt_ctf_event_put);
if (!stream->events) {
bt_ctf_stream_get(stream);
g_ptr_array_add(trace->streams, stream);
+ bt_ctf_stream_class_freeze(stream_class);
trace->frozen = 1;
return stream;
struct bt_ctf_field *event_context;
};
+/* Stream class should be locked by the caller after creating a stream */
BT_HIDDEN
struct bt_ctf_stream *bt_ctf_stream_create(
struct bt_ctf_stream_class *stream_class,