lib: save and restore current thread error when calling destruction listeners and...
[babeltrace.git] / src / lib / trace-ir / trace-class.c
index f9aedea0947c2b93092d5917c5575cb69d463352..153300998afd06f1e41bebe9818316adc4cf6199 100644 (file)
@@ -80,6 +80,8 @@ void destroy_trace_class(struct bt_object *obj)
         */
        if (tc->destruction_listeners) {
                uint64_t i;
+               const struct bt_error *saved_error;
+
                BT_LIB_LOGD("Calling trace class destruction listener(s): %!+T", tc);
 
                /*
@@ -94,6 +96,8 @@ void destroy_trace_class(struct bt_object *obj)
                */
                tc->base.ref_count++;
 
+               saved_error = bt_current_thread_take_error();
+
                /* Call all the trace class destruction listeners */
                for (i = 0; i < tc->destruction_listeners->len; i++) {
                        struct bt_trace_class_destruction_listener_elem elem =
@@ -113,6 +117,10 @@ void destroy_trace_class(struct bt_object *obj)
                }
                g_array_free(tc->destruction_listeners, TRUE);
                tc->destruction_listeners = NULL;
+
+               if (saved_error) {
+                       BT_CURRENT_THREAD_MOVE_ERROR_AND_RESET(saved_error);
+               }
        }
 
        if (tc->stream_classes) {
This page took 0.024399 seconds and 4 git commands to generate.