src.ctf.fs: make ctf_fs_trace::trace a bt2::Trace::Shared
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Dec 2023 04:40:07 +0000 (04:40 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
Change-Id: I4fabe113da7b5adb794377706ab07fac9b59df02
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8280
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12318
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/fs-src/fs.cpp
src/plugins/ctf/fs-src/fs.hpp

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) {
index 97a8357352d4cdde4ca900a95819f703985e652f..0607d3f2f40c506f606db9be6ba843645d1849f2 100644 (file)
@@ -58,8 +58,7 @@ struct ctf_fs_trace
     /* Owned by this */
     struct ctf_fs_metadata *metadata = nullptr;
 
-    /* Owned by this */
-    bt_trace *trace = nullptr;
+    bt2::Trace::Shared trace;
 
     std::vector<ctf_fs_ds_file_group::UP> ds_file_groups;
 
This page took 0.026412 seconds and 4 git commands to generate.