summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-01-18 11:17:18 +0000
committerJabiertxof <jabier.arraiza@marker.es>2019-01-18 11:17:18 +0000
commit63c9b84350202bbe26edc928ab43804e4dc8da24 (patch)
tree2c7aaa91c42f02acf7225094ad07652fa76e2315 /src
parentRemove unwanted atributes from text and comment nodes (diff)
downloadinkscape-63c9b84350202bbe26edc928ab43804e4dc8da24.tar.gz
inkscape-63c9b84350202bbe26edc928ab43804e4dc8da24.zip
Remove crashes when using attributes XML dialog
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/attrdialog.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/ui/dialog/attrdialog.cpp b/src/ui/dialog/attrdialog.cpp
index 22a443e10..f173cc3ab 100644
--- a/src/ui/dialog/attrdialog.cpp
+++ b/src/ui/dialog/attrdialog.cpp
@@ -336,24 +336,22 @@ void AttrDialog::nameEdited (const Glib::ustring& path, const Glib::ustring& nam
Gtk::TreeModel::Row row = *_store->get_iter(path);
if(row && this->_repr) {
Glib::ustring old_name = row[_attrColumns._attributeName];
- if (old_name == "content") {
+ if (old_name == "content" ||
+ old_name == name)
+ {
return;
}
Glib::ustring value = row[_attrColumns._attributeValue];
+ // Move to editing value, we set the name as a temporary store value
if(!old_name.empty()) {
- // Remove named value
- _repr->setAttribute(old_name, nullptr, false);
- _repr->setAttribute(name, value, false);
- this->setUndo(_("Rename attribute"));
- } else {
- // Move to editing value, we set the name as a temporary store value
+ // Remove old named value
+ _repr->setAttribute(old_name.c_str(), nullptr, false);
+ }
+ if(!name.empty()) {
+ _repr->setAttribute(name.c_str(), value, false);
row[_attrColumns._attributeName] = name;
- // This would be nice to have, but it causes a crash when treeview looses focus
- // because signaling vs. focus is in some sort of conflict.
- //Gtk::TreeModel::Path _path = (Gtk::TreeModel::Path)row;
- //_treeView.set_cursor(_path, *_valueCol, true);
- //grab_focus();
}
+ this->setUndo(_("Rename attribute"));
}
}
@@ -372,8 +370,12 @@ void AttrDialog::valueEdited (const Glib::ustring& path, const Glib::ustring& va
if (name == "content") {
_repr->setContent(value.c_str());
} else {
- _repr->setAttribute(name, value, false);
+ _repr->setAttribute(name.c_str(), value, false);
}
+ if(!value.empty()) {
+ row[_attrColumns._attributeValue] = value;
+ }
+
this->setUndo(_("Change attribute value"));
}
}