summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-09 22:43:52 +0000
committerDavid Robillard <d@drobilla.net>2009-05-09 22:43:52 +0000
commit43e673a183844709ecd41e08d97f96d9228a544c (patch)
tree9b4e107b02c556827aece5ab3e690fc70fdb614f
parentad23d3e731514515d21e0f2c93214408054984d2 (diff)
downloadpatchage-43e673a183844709ecd41e08d97f96d9228a544c.tar.gz
patchage-43e673a183844709ecd41e08d97f96d9228a544c.tar.bz2
patchage-43e673a183844709ecd41e08d97f96d9228a544c.zip
Fix crash on LASH client removal.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@1966 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/Project.cpp2
-rw-r--r--src/ProjectList.cpp23
2 files changed, 16 insertions, 9 deletions
diff --git a/src/Project.cpp b/src/Project.cpp
index 28d6aaa..655974c 100644
--- a/src/Project.cpp
+++ b/src/Project.cpp
@@ -121,8 +121,8 @@ Project::on_client_removed(const string& id)
client = *iter;
if (client->get_id() == id) {
- _impl->clients.erase(iter);
_signal_client_removed.emit(client);
+ _impl->clients.erase(iter);
return;
}
}
diff --git a/src/ProjectList.cpp b/src/ProjectList.cpp
index 4b87e31..cc9d3ab 100644
--- a/src/ProjectList.cpp
+++ b/src/ProjectList.cpp
@@ -65,7 +65,7 @@ struct ProjectListImpl : public sigc::trackable {
ProjectList::ProjectList(
Patchage* app,
- Session* session)
+ Session* session)
{
_impl = new ProjectListImpl(app->xml(), app);
session->_signal_project_added.connect(mem_fun(_impl, &ProjectListImpl::project_added));
@@ -216,10 +216,14 @@ ProjectListImpl::project_added(
row[_columns.name] = project_name;
row[_columns.project] = project;
- project->_signal_renamed.connect(bind(mem_fun(this, &ProjectListImpl::project_renamed), iter));
- project->_signal_modified_status_changed.connect(bind(mem_fun(this, &ProjectListImpl::project_renamed), iter));
- project->_signal_client_added.connect(bind(mem_fun(this, &ProjectListImpl::client_added), iter));
- project->_signal_client_removed.connect(bind(mem_fun(this, &ProjectListImpl::client_removed), iter));
+ project->_signal_renamed.connect(
+ bind(mem_fun(this, &ProjectListImpl::project_renamed), iter));
+ project->_signal_modified_status_changed.connect(
+ bind(mem_fun(this, &ProjectListImpl::project_renamed), iter));
+ project->_signal_client_added.connect(
+ bind(mem_fun(this, &ProjectListImpl::client_added), iter));
+ project->_signal_client_removed.connect(
+ bind(mem_fun(this, &ProjectListImpl::client_removed), iter));
}
void
@@ -263,7 +267,7 @@ ProjectListImpl::project_renamed(
void
ProjectListImpl::client_added(
- shared_ptr<LashClient> client,
+ shared_ptr<LashClient> client,
Gtk::TreeModel::iterator iter)
{
Gtk::TreeModel::Path path = _model->get_path(iter);
@@ -278,15 +282,18 @@ ProjectListImpl::client_added(
void
ProjectListImpl::client_removed(
- shared_ptr<LashClient> client,
+ shared_ptr<LashClient> client,
Gtk::TreeModel::iterator iter)
{
+ if (!iter)
+ return;
+
Gtk::TreeModel::Path path = _model->get_path(iter);
Gtk::TreeModel::Row row = *iter;
Gtk::TreeNodeChildren childs = row.children();
- for (Gtk::TreeModel::iterator child_iter = childs.begin(); iter != childs.end(); child_iter++) {
+ for (Gtk::TreeModel::iterator child_iter = childs.begin(); child_iter; child_iter++) {
row = *child_iter;
if (row[_columns.name] == client->get_name()) {