src.ctf.fs: make ctf_fs_trace::trace a bt2::Trace::Shared
[babeltrace.git] / src / plugins / ctf / fs-src / fs.cpp
index 22baaf3b39736f4caa3dfe1247acfd931cfa6b53..bd0e24b894474a2cbf576d8eb6d645a89d157340 100644 (file)
@@ -261,8 +261,6 @@ static void ctf_fs_trace_destroy(struct ctf_fs_trace *ctf_fs_trace)
         return;
     }
 
-    BT_TRACE_PUT_REF_AND_RESET(ctf_fs_trace->trace);
-
     if (ctf_fs_trace->path) {
         g_string_free(ctf_fs_trace->path, TRUE);
     }
@@ -765,19 +763,22 @@ static ctf_fs_trace::UP ctf_fs_trace_create(const char *path, const char *name,
     }
 
     if (ctf_fs_trace->metadata->trace_class) {
-        ctf_fs_trace->trace = bt_trace_create(ctf_fs_trace->metadata->trace_class);
-        if (!ctf_fs_trace->trace) {
+        bt_trace *trace = bt_trace_create(ctf_fs_trace->metadata->trace_class);
+        if (!trace) {
             goto error;
         }
+
+        ctf_fs_trace->trace = bt2::Trace::Shared::createWithoutRef(trace);
     }
 
     if (ctf_fs_trace->trace) {
-        ret = ctf_trace_class_configure_ir_trace(ctf_fs_trace->metadata->tc, ctf_fs_trace->trace);
+        ret = ctf_trace_class_configure_ir_trace(ctf_fs_trace->metadata->tc,
+                                                 ctf_fs_trace->trace->libObjPtr());
         if (ret) {
             goto error;
         }
 
-        ret = set_trace_name(ctf_fs_trace->trace, name, ctf_fs_trace->logger);
+        ret = set_trace_name(ctf_fs_trace->trace->libObjPtr(), name, ctf_fs_trace->logger);
         if (ret) {
             goto error;
         }
@@ -1783,13 +1784,15 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace)
 
         if (ds_file_group->stream_id == UINT64_C(-1)) {
             /* No stream ID: use 0 */
-            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->libObjPtr(),
+                                         ctf_fs_trace->next_stream_id);
             ctf_fs_trace->next_stream_id++;
         } else {
             /* Specific 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);
+            stream =
+                bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace->libObjPtr(),
+                                         (uint64_t) ds_file_group->stream_id);
         }
 
         if (!stream) {
This page took 0.028991 seconds and 4 git commands to generate.