ir: bt_ctf_stream_append_event(): do not append event with parent
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 18 Feb 2016 00:21:26 +0000 (19:21 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Feb 2016 18:07:58 +0000 (13:07 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/stream.c

index 7136b26be0b3d9c491d1e688803488b00e02a005..e9ff83e4982e2521b41c4de40b982ab1715cd810 100644 (file)
@@ -563,6 +563,19 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream,
                goto end;
        }
 
+       /*
+        * The event is not supposed to have a parent stream at this
+        * point. The only other way an event can have a parent stream
+        * is if it was assigned when setting a packet to the event,
+        * in which case the packet's stream is not a writer stream,
+        * and thus the user is trying to append an event which belongs
+        * to another stream.
+        */
+       if (event->base.parent) {
+               ret = -1;
+               goto end;
+       }
+
        bt_object_set_parent(event, stream);
        ret = bt_ctf_event_populate_event_header(event);
        if (ret) {
This page took 0.024734 seconds and 4 git commands to generate.