X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fir%2Fstream.c;fp=formats%2Fctf%2Fir%2Fstream.c;h=e9ff83e4982e2521b41c4de40b982ab1715cd810;hp=7136b26be0b3d9c491d1e688803488b00e02a005;hb=fa29ba839dc350d1e86ecc542a66b59a586e1ec1;hpb=33c4e0f264c24e78020ccf6bfbcb541bd30cb848 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) {