From fb056f1dc348c36502bfd91c8e9ebc42c1488300 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Fri, 18 Jan 2019 15:36:23 +0100 Subject: Remove crashes when using attributes XML dialog with Objects dialog open (II) --- src/ui/dialog/attrdialog.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/ui/dialog/attrdialog.cpp') diff --git a/src/ui/dialog/attrdialog.cpp b/src/ui/dialog/attrdialog.cpp index f173cc3ab..4ccb037ef 100644 --- a/src/ui/dialog/attrdialog.cpp +++ b/src/ui/dialog/attrdialog.cpp @@ -274,12 +274,13 @@ void AttrDialog::onAttrDelete(Glib::ustring path) Gtk::TreeModel::Row row = *_store->get_iter(path); if (row) { Glib::ustring name = row[_attrColumns._attributeName]; - if(name == "content") { + if (name == "content") { return; } else { + this->_store->erase(row); this->_repr->setAttribute(name.c_str(), nullptr, false); + this->setUndo(_("Delete attribute")); } - this->setUndo(_("Delete attribute")); } } @@ -304,9 +305,10 @@ bool AttrDialog::onKeyPressed(GdkEventKey *event) if(name == "content") { return true; } else { + this->_store->erase(row); this->_repr->setAttribute(name.c_str(), nullptr, false); + this->setUndo(_("Delete attribute")); } - this->setUndo(_("Delete attribute")); return true; } case GDK_KEY_plus: @@ -343,11 +345,11 @@ void AttrDialog::nameEdited (const Glib::ustring& path, const Glib::ustring& nam } Glib::ustring value = row[_attrColumns._attributeValue]; // Move to editing value, we set the name as a temporary store value - if(!old_name.empty()) { + if (!old_name.empty()) { // Remove old named value _repr->setAttribute(old_name.c_str(), nullptr, false); } - if(!name.empty()) { + if (!name.empty()) { _repr->setAttribute(name.c_str(), value, false); row[_attrColumns._attributeName] = name; } -- cgit v1.2.3