diff options
| author | kamalpreetgrewal <grewalkamal005@gmail.com> | 2016-07-13 15:02:24 +0000 |
|---|---|---|
| committer | kamalpreetgrewal <grewalkamal005@gmail.com> | 2016-07-13 15:02:24 +0000 |
| commit | c1b1cf45b4b1feb43d326c2660e70408185ca64d (patch) | |
| tree | 37bca903d67e2cf8cba1a4e22dddf85edc6088d5 /src/ui/dialog/styledialog.cpp | |
| parent | Propagate changes to object tree with changes in style element (diff) | |
| download | inkscape-c1b1cf45b4b1feb43d326c2660e70408185ca64d.tar.gz inkscape-c1b1cf45b4b1feb43d326c2660e70408185ca64d.zip | |
Fix crash when deleting selector
(bzr r14949.1.47)
Diffstat (limited to 'src/ui/dialog/styledialog.cpp')
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index ac51e36c1..ca4f35bb6 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -307,7 +307,7 @@ void StyleDialog::_delSelector() Gtk::TreeModel::Row row = *iter; std::string sel, key, value; std::vector<_selectorVecType>::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it ) { + for (it = _selectorVec.begin(); it != _selectorVec.end();) { sel = (*it).second; REMOVE_SPACES(sel); if (!sel.empty()) { @@ -318,10 +318,11 @@ void StyleDialog::_delSelector() value = strtok(temp, "}"); } } - } - if (_selectorVec.size() != 0) { - if (!row.parent()) { + Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; + std::string matchSelector = selectedRowLabel; + REMOVE_SPACES(s1); + if (key == matchSelector) { if (!row.children().empty()) { for (Gtk::TreeModel::Children::iterator child = row.children().begin(); child != row.children().end(); ++child) { @@ -331,20 +332,24 @@ void StyleDialog::_delSelector() } } } - _selectorVec.erase(it); + it = _selectorVec.erase(it); _store->erase(row); } + else { + ++it; + } /** - * If there is a _styleChild which contains the style element, then - * the content in style element is updated else the _styleChild is - * obtained and its content is set. + * The _stylechild is obtained which contains the style element and + * the content in style element is updated. */ - if (_styleChild) { - _updateStyleContent(); + _styleChild = _styleElementNode(); + + if (_selectorVec.size() == 0) { + _document->getReprRoot()->removeChild(_styleChild); + _styleExists = false; } else { - _styleChild = _styleElementNode(); _updateStyleContent(); } } |
