summaryrefslogtreecommitdiffstats
path: root/src/attribute-sort-util.cpp
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
commit509ca3687330fea576ea67ae6c7f31d16e66b800 (patch)
tree9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/attribute-sort-util.cpp
parentupdated to latest trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.tar.gz
inkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.zip
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/attribute-sort-util.cpp')
-rw-r--r--src/attribute-sort-util.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp
index ef08a142f..7aa8d8357 100644
--- a/src/attribute-sort-util.cpp
+++ b/src/attribute-sort-util.cpp
@@ -11,7 +11,6 @@
#include <fstream>
#include <sstream>
-#include <string>
#include <iostream>
#include <vector>
#include <utility> // std::pair
@@ -21,7 +20,6 @@
#include "xml/repr.h"
#include "xml/attribute-record.h"
-#include "xml/sp-css-attr.h"
#include "attributes.h"
@@ -65,9 +63,11 @@ void sp_attribute_sort_recursive(Node *repr) {
*/
bool cmp(std::pair< Glib::ustring, Glib::ustring > const &a,
std::pair< Glib::ustring, Glib::ustring > const &b) {
+ unsigned val_a = sp_attribute_lookup(a.first.c_str());
unsigned val_b = sp_attribute_lookup(b.first.c_str());
- if (val_b == 0) return true; // Unknown attributes at end.
- return sp_attribute_lookup(a.first.c_str()) < val_b;
+ if (val_a == 0) return false; // Unknown attributes at end.
+ if (val_b == 0) return true; // Unknown attributes at end.
+ return val_a < val_b;
}
/**
@@ -103,12 +103,17 @@ void sp_attribute_sort_element(Node *repr) {
//for (auto it: my_list) {
for (std::vector<std::pair< Glib::ustring, Glib::ustring > >::iterator it = my_list.begin();
it != my_list.end(); ++it) {
- repr->setAttribute( it->first.c_str(), NULL, false );
+ // Removing "inkscape:label" results in crash when Layers dialog is open.
+ if (it->first != "inkscape:label") {
+ repr->setAttribute( it->first.c_str(), NULL, false );
+ }
}
// Insert all attributes in proper order
for (std::vector<std::pair< Glib::ustring, Glib::ustring > >::iterator it = my_list.begin();
it != my_list.end(); ++it) {
- repr->setAttribute( it->first.c_str(), it->second.c_str(), false );
+ if (it->first != "inkscape:label") {
+ repr->setAttribute( it->first.c_str(), it->second.c_str(), false );
+ }
}
}