lib: graph API: return borrowed references when adding to an object
[babeltrace.git] / src / bindings / python / bt2 / bt2 / graph.py
index a3926e5951ff14df902f47c5b5203281bad27cbd..9611c6e287b9f7f69c8a1560317c5d75a56848f0 100644 (file)
@@ -119,7 +119,9 @@ class Graph(object._SharedObject):
         )
         utils._handle_func_status(status, 'cannot add component to graph')
         assert comp_ptr
-        return bt2_component._create_component_from_const_ptr(comp_ptr, cc_type)
+        return bt2_component._create_component_from_const_ptr_and_get_ref(
+            comp_ptr, cc_type
+        )
 
     def connect_ports(self, upstream_port, downstream_port):
         utils._check_type(upstream_port, bt2_port._OutputPortConst)
@@ -129,7 +131,7 @@ class Graph(object._SharedObject):
         )
         utils._handle_func_status(status, 'cannot connect component ports within graph')
         assert conn_ptr
-        return bt2_connection._ConnectionConst._create_from_ptr(conn_ptr)
+        return bt2_connection._ConnectionConst._create_from_ptr_and_get_ref(conn_ptr)
 
     def add_port_added_listener(self, listener):
         if not callable(listener):
@@ -159,5 +161,7 @@ class Graph(object._SharedObject):
         utils._check_type(interrupter, bt2_interrupter.Interrupter)
         native_bt.graph_add_interrupter(self._ptr, interrupter._ptr)
 
-    def interrupt(self):
-        native_bt.graph_interrupt(self._ptr)
+    @property
+    def default_interrupter(self):
+        ptr = native_bt.graph_borrow_default_interrupter(self._ptr)
+        return bt2_interrupter.Interrupter._create_from_ptr_and_get_ref(ptr)
This page took 0.023683 seconds and 4 git commands to generate.