bt2: remove BT CC entry from global HT in _UserComponentType.__del__()
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_component_class.i.h
index 479f9abf737595e2c738e0e43ac70d57ca08aca0..fc10efef34b6bff60ab069c7075a43c5930703a2 100644 (file)
 
 static GHashTable *bt_cc_ptr_to_py_cls;
 
+static
+void bt_bt2_unregister_cc_ptr_to_py_cls(const bt_component_class *comp_cls)
+{
+       gboolean existed;
+
+       if (!bt_cc_ptr_to_py_cls) {
+               return;
+       }
+
+       existed = g_hash_table_remove(bt_cc_ptr_to_py_cls, comp_cls);
+       BT_ASSERT(existed);
+}
+
 static
 void register_cc_ptr_to_py_cls(struct bt_component_class *bt_cc,
                PyObject *py_cls)
@@ -85,6 +98,7 @@ void native_comp_class_dtor(void) {
        if (bt_cc_ptr_to_py_cls) {
                BT_LOGD_STR("Destroying native component class to Python component class hash table.");
                g_hash_table_destroy(bt_cc_ptr_to_py_cls);
+               bt_cc_ptr_to_py_cls = NULL;
        }
 }
 
This page took 0.023087 seconds and 4 git commands to generate.