X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Ftrace.c;h=688a113eb77f41862856c9403a7383455e54ba9b;hb=43c59509042845f8d42c3e99ec74d45fa2dc0908;hp=d155cae2e0ea205c0a04ffc5ab0d3019d6d637ed;hpb=17f3083a0b4d318d3303c8a5bfa63db6a874ec73;p=babeltrace.git diff --git a/src/lib/trace-ir/trace.c b/src/lib/trace-ir/trace.c index d155cae2..688a113e 100644 --- a/src/lib/trace-ir/trace.c +++ b/src/lib/trace-ir/trace.c @@ -27,13 +27,11 @@ #include "lib/assert-pre.h" #include "lib/assert-post.h" #include -#include #include #include "ctf-writer/functor.h" #include "ctf-writer/clock.h" #include "compat/compiler.h" #include -#include #include "lib/value.h" #include #include "compat/endian.h" @@ -82,6 +80,8 @@ void destroy_trace(struct bt_object *obj) */ if (trace->destruction_listeners) { uint64_t i; + const struct bt_error *saved_error; + BT_LIB_LOGD("Calling trace destruction listener(s): %!+t", trace); /* @@ -96,6 +96,8 @@ void destroy_trace(struct bt_object *obj) */ trace->base.ref_count++; + saved_error = bt_current_thread_take_error(); + /* Call all the trace destruction listeners */ for (i = 0; i < trace->destruction_listeners->len; i++) { struct bt_trace_destruction_listener_elem elem = @@ -115,6 +117,10 @@ void destroy_trace(struct bt_object *obj) } g_array_free(trace->destruction_listeners, TRUE); trace->destruction_listeners = NULL; + + if (saved_error) { + BT_CURRENT_THREAD_MOVE_ERROR_AND_RESET(saved_error); + } } if (trace->name.str) {