Fix: Create stream after adding its stream class to a trace
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 2 Jul 2015 18:43:12 +0000 (14:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 2 Jul 2015 18:43:12 +0000 (14:43 -0400)
This ensures that a stream class' id is set before we create a stream
instance and initialize its packet header. Otherwise, the packet header
stream_id is initialized to its default value (0).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/trace.c

index 158f2b8bbc2e6d13ea8555ecb95a8cff0011d306..d911dfd69946029e8078814a4a94ac30f2ca1af1 100644 (file)
@@ -156,11 +156,6 @@ struct bt_ctf_stream *bt_ctf_trace_create_stream(struct bt_ctf_trace *trace,
                goto error;
        }
 
-       stream = bt_ctf_stream_create(stream_class, trace);
-       if (!stream) {
-               goto error;
-       }
-
        for (i = 0; i < trace->stream_classes->len; i++) {
                if (trace->stream_classes->pdata[i] == stream_class) {
                        stream_class_found = 1;
@@ -174,6 +169,11 @@ struct bt_ctf_stream *bt_ctf_trace_create_stream(struct bt_ctf_trace *trace,
                }
        }
 
+       stream = bt_ctf_stream_create(stream_class, trace);
+       if (!stream) {
+               goto error;
+       }
+
        bt_ctf_stream_get(stream);
        g_ptr_array_add(trace->streams, stream);
 
This page took 0.024899 seconds and 4 git commands to generate.