From 51cd1dfb720642e51b811558ddead6cd47ceee0f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 12 Jun 2016 20:08:22 +0200 Subject: Fix faulty comparison function. (bzr r14983) --- src/attribute-sort-util.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/attribute-sort-util.cpp') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index ef08a142f..d0f45c418 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -65,9 +65,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; } /** -- cgit v1.2.3 From f5c74e3a9d4e23e6cc86851b426dd05958e907ee Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 4 Jul 2016 14:30:44 +0200 Subject: Prevent data-losing crash when sorting attributes and Layer dialog open. (bzr r15007) --- src/attribute-sort-util.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/attribute-sort-util.cpp') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index d0f45c418..5c01f7914 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -105,12 +105,17 @@ void sp_attribute_sort_element(Node *repr) { //for (auto it: my_list) { for (std::vector >::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 >::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 ); + } } } -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/attribute-sort-util.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/attribute-sort-util.cpp') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index 5c01f7914..7aa8d8357 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include // std::pair @@ -21,7 +20,6 @@ #include "xml/repr.h" #include "xml/attribute-record.h" -#include "xml/sp-css-attr.h" #include "attributes.h" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/attribute-sort-util.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/attribute-sort-util.cpp') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index 7aa8d8357..5c01f7914 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include // std::pair @@ -20,6 +21,7 @@ #include "xml/repr.h" #include "xml/attribute-record.h" +#include "xml/sp-css-attr.h" #include "attributes.h" -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/attribute-sort-util.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/attribute-sort-util.cpp') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index 5c01f7914..7aa8d8357 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include // std::pair @@ -21,7 +20,6 @@ #include "xml/repr.h" #include "xml/attribute-record.h" -#include "xml/sp-css-attr.h" #include "attributes.h" -- cgit v1.2.3