summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-01-18 14:36:23 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-01-18 14:36:23 +0000
commitfb056f1dc348c36502bfd91c8e9ebc42c1488300 (patch)
treef609afdd4fa2985e07636e2610431d3e48ff23aa /src/ui
parentRemove crashes when using attributes XML dialog (diff)
downloadinkscape-fb056f1dc348c36502bfd91c8e9ebc42c1488300.tar.gz
inkscape-fb056f1dc348c36502bfd91c8e9ebc42c1488300.zip
Remove crashes when using attributes XML dialog with Objects dialog open (II)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/attrdialog.cpp12
-rw-r--r--src/ui/dialog/objects.cpp9
2 files changed, 13 insertions, 8 deletions
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;
}
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index 9e115a2d6..f02df8042 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -422,13 +422,16 @@ void ObjectsPanel::_updateObject( SPObject *obj, bool recurse ) {
bool ObjectsPanel::_checkForUpdated(const Gtk::TreeIter& iter, SPObject* obj)
{
Gtk::TreeModel::Row row = *iter;
- if ( obj == row[_model->_colObject] )
+ if (obj && *iter && obj == row[_model->_colObject] )
{
//We found our item in the tree!! Update it!
SPItem * item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : nullptr;
SPGroup * group = SP_IS_GROUP(obj) ? SP_GROUP(obj) : nullptr;
-
- row[_model->_colLabel] = obj->label() ? obj->label() : obj->getId();
+ gchar const * id = obj->getId();
+ if (!id) {
+ id = _("no-id");
+ }
+ row[_model->_colLabel] = obj->label() ? obj->label() : id;
row[_model->_colVisible] = item ? !item->isHidden() : false;
row[_model->_colLocked] = item ? !item->isSensitive() : false;
row[_model->_colType] = group ? (group->layerMode() == SPGroup::LAYER ? 2 : 1) : 0;