summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/InputPort.cpp8
-rw-r--r--src/engine/PatchImpl.cpp2
-rw-r--r--src/gui/LoadPatchWindow.cpp4
-rw-r--r--src/gui/LoadSubpatchWindow.cpp4
4 files changed, 15 insertions, 3 deletions
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 80ae836d..cc72a7c5 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -163,10 +163,16 @@ InputPort::remove_connection(const OutputPort* src_port)
ThreadManager::assert_thread(THREAD_PROCESS);
Connections::Node* connection = NULL;
- for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i)
+ for (Connections::iterator i = _connections.begin(); i != _connections.end();) {
+ Connections::iterator next = i;
+ ++next;
+
if ((*i)->src_port() == src_port)
connection = _connections.erase(i);
+ i = next;
+ }
+
if ( ! connection) {
error << "[InputPort::remove_connection] Connection not found!" << endl;
return NULL;
diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp
index 96841b33..771c9d6d 100644
--- a/src/engine/PatchImpl.cpp
+++ b/src/engine/PatchImpl.cpp
@@ -377,6 +377,7 @@ PatchImpl::remove_port(const string& symbol)
if ((*i)->symbol() == symbol) {
ret = _input_ports.erase(i);
found = true;
+ break;
}
}
@@ -385,6 +386,7 @@ PatchImpl::remove_port(const string& symbol)
if ((*i)->symbol() == symbol) {
ret = _output_ports.erase(i);
found = true;
+ break;
}
}
diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp
index 86e0d448..cb3aaf06 100644
--- a/src/gui/LoadPatchWindow.cpp
+++ b/src/gui/LoadPatchWindow.cpp
@@ -72,8 +72,10 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno
// Add global examples directory to "shortcut folders" (bookmarks)
const string examples_dir = Shared::data_file_path("patches");
DIR* d = opendir(examples_dir.c_str());
- if (d != NULL)
+ if (d != NULL) {
add_shortcut_folder(examples_dir);
+ closedir(d);
+ }
}
diff --git a/src/gui/LoadSubpatchWindow.cpp b/src/gui/LoadSubpatchWindow.cpp
index e580fa49..ef56a945 100644
--- a/src/gui/LoadSubpatchWindow.cpp
+++ b/src/gui/LoadSubpatchWindow.cpp
@@ -70,8 +70,10 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP
// Add global examples directory to "shortcut folders" (bookmarks)
const string examples_dir = Shared::data_file_path("patches");
DIR* d = opendir(examples_dir.c_str());
- if (d != NULL)
+ if (d != NULL) {
add_shortcut_folder(examples_dir);
+ closedir(d);
+ }
}