diff options
-rw-r--r-- | src/Project.cpp | 2 | ||||
-rw-r--r-- | src/ProjectList.cpp | 23 |
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()) { |