From 9cde7e0c1097cf0aa52113a942a3b88d930568b6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 22 Jun 2006 06:15:18 +0000 Subject: Fix destroying connected nodes; Partial fix for port default values. git-svn-id: http://svn.drobilla.net/lad/ingen@76 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/events/DisconnectionEvent.cpp | 75 ++++++++++++++------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'src/libs/engine/events') diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index f3524500..f2f54387 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -96,48 +96,49 @@ DisconnectionEvent::pre_process() m_src_port = om->object_store()->find_port(m_src_port_path); m_dst_port = om->object_store()->find_port(m_dst_port_path); + } + + if (m_src_port == NULL || m_dst_port == NULL) { + m_error = PORT_NOT_FOUND; + QueuedEvent::pre_process(); + return; + } - if (m_src_port == NULL || m_dst_port == NULL) { - m_error = PORT_NOT_FOUND; - QueuedEvent::pre_process(); - return; - } - - if (m_src_port->type() != m_dst_port->type() || m_src_port->buffer_size() != m_dst_port->buffer_size()) { - m_error = TYPE_MISMATCH; - QueuedEvent::pre_process(); - return; - } - - /*if (port1->is_output() && port2->is_input()) { - m_src_port = port1; - m_dst_port = port2; - } else if (port2->is_output() && port1->is_input()) { - m_src_port = port2; - m_dst_port = port1; - } else { - m_error = TYPE_MISMATCH; - QueuedEvent::pre_process(); - return; - }*/ + if (m_src_port->type() != m_dst_port->type() || m_src_port->buffer_size() != m_dst_port->buffer_size()) { + m_error = TYPE_MISMATCH; + QueuedEvent::pre_process(); + return; + } - // Create the typed event to actually do the work - const DataType type = m_src_port->type(); - if (type == DataType::FLOAT) { - m_typed_event = new TypedDisconnectionEvent(m_responder, - dynamic_cast*>(m_src_port), dynamic_cast*>(m_dst_port)); - } else if (type == DataType::MIDI) { - m_typed_event = new TypedDisconnectionEvent(m_responder, - dynamic_cast*>(m_src_port), dynamic_cast*>(m_dst_port)); - } else { - m_error = TYPE_MISMATCH; - QueuedEvent::pre_process(); - return; - } + /*if (port1->is_output() && port2->is_input()) { + m_src_port = port1; + m_dst_port = port2; + } else if (port2->is_output() && port1->is_input()) { + m_src_port = port2; + m_dst_port = port1; + } else { + m_error = TYPE_MISMATCH; + QueuedEvent::pre_process(); + return; + }*/ + + // Create the typed event to actually do the work + const DataType type = m_src_port->type(); + if (type == DataType::FLOAT) { + m_typed_event = new TypedDisconnectionEvent(m_responder, + dynamic_cast*>(m_src_port), dynamic_cast*>(m_dst_port)); + } else if (type == DataType::MIDI) { + m_typed_event = new TypedDisconnectionEvent(m_responder, + dynamic_cast*>(m_src_port), dynamic_cast*>(m_dst_port)); + } else { + m_error = TYPE_MISMATCH; + QueuedEvent::pre_process(); + return; } + assert(m_typed_event); m_typed_event->pre_process(); - + QueuedEvent::pre_process(); } -- cgit v1.2.1