private void CleanupCallback() { if (ossia_node != IntPtr.Zero && node_ossia_remove_callback != IntPtr.Zero) { Network.ossia_node_remove_deleting_callback(ossia_node, node_ossia_remove_callback); ossia_node = IntPtr.Zero; ossia_parameter = null; node_remove_callback = null; node_ossia_remove_callback = IntPtr.Zero; } }
public Node(IntPtr n) { ossia_node = n; node_remove_callback = new Network.ossia_node_callback((IntPtr ctx, IntPtr node) => CleanupCallback()); IntPtr intptr_delegate = Marshal.GetFunctionPointerForDelegate(node_remove_callback); node_ossia_remove_callback = Network.ossia_node_add_deleting_callback(ossia_node, intptr_delegate, (IntPtr)0); var addr = Network.ossia_node_get_parameter(ossia_node); if (addr != IntPtr.Zero) { ossia_parameter = new Ossia.Parameter(addr); } }