src.ctf.fs: make ctf_fs_ds_file_group::stream a bt2::Stream::Shared
[babeltrace.git] / src / plugins / ctf / fs-src / fs.cpp
index 40e50085fa87aabf8543bcbf35a3518c38668195..1db4fe658d03ba29332fcfef19cf5774ae32d390 100644 (file)
@@ -1835,18 +1835,20 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace)
         BT_ASSERT(ds_file_group->sc->ir_sc);
         BT_ASSERT(ctf_fs_trace->trace);
 
+        bt_stream *stream;
+
         if (ds_file_group->stream_id == UINT64_C(-1)) {
             /* No stream ID: use 0 */
-            ds_file_group->stream = bt_stream_create_with_id(
-                ds_file_group->sc->ir_sc, ctf_fs_trace->trace, ctf_fs_trace->next_stream_id);
+            stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace,
+                                              ctf_fs_trace->next_stream_id);
             ctf_fs_trace->next_stream_id++;
         } else {
             /* Specific stream ID */
-            ds_file_group->stream = bt_stream_create_with_id(
-                ds_file_group->sc->ir_sc, ctf_fs_trace->trace, (uint64_t) ds_file_group->stream_id);
+            stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace,
+                                              (uint64_t) ds_file_group->stream_id);
         }
 
-        if (!ds_file_group->stream) {
+        if (!stream) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
                                          "Cannot create stream for DS file group: "
                                          "addr={}, stream-name=\"{}\"",
@@ -1854,12 +1856,14 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace)
             goto error;
         }
 
-        ret = bt_stream_set_name(ds_file_group->stream, name->str);
+        ds_file_group->stream = bt2::Stream::Shared::createWithoutRef(stream);
+
+        ret = bt_stream_set_name(ds_file_group->stream->libObjPtr(), name->str);
         if (ret) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
                                          "Cannot set stream's name: "
                                          "addr={}, stream-name=\"{}\"",
-                                         fmt::ptr(ds_file_group->stream), name->str);
+                                         fmt::ptr(ds_file_group->stream->libObjPtr()), name->str);
             goto error;
         }
 
This page took 0.027363 seconds and 4 git commands to generate.