From: Philippe Proulx Date: Thu, 18 Feb 2016 00:21:26 +0000 (-0500) Subject: ir: bt_ctf_stream_append_event(): do not append event with parent X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=fa29ba839dc350d1e86ecc542a66b59a586e1ec1 ir: bt_ctf_stream_append_event(): do not append event with parent Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index 7136b26b..e9ff83e4 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -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) {