From bd5887c2c04cc61dc146d0495d05bcdf89d5c1e4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Thu, 16 Nov 2017 22:50:38 +0100 Subject: Fix last bug pointed by Eduard Brawn in MR 126 --- src/ui/dialog/symbols.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 3a15813c1..c552a0bba 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -434,8 +434,8 @@ void SymbolsDialog::rebuild() { //We are not in search all docs if (search->get_text() != _("Searching...") && - search->get_text() != _("Loading all symbols...") && - search->get_text() != _("Searching....") ) + search->get_text() != _("Loading all symbols...") && + search->get_text() != _("Searching....") ) { search_str = ""; search->set_text(""); @@ -572,17 +572,17 @@ SPDocument* SymbolsDialog::selectedSymbols() { SPDocument* symbol_document = symbol_sets[doc_title]; if( !symbol_document ) { symbol_document = getSymbolsSet(doc_title).second; - // Symbol must be from Current Document (this method of checking should be language independent). - if( !symbol_document ) { - // Symbol must be from Current Document (this method of - // checking should be language independent). - symbol_document = current_document; - add_symbol->set_sensitive( true ); - remove_symbol->set_sensitive( true ); - } else { - add_symbol->set_sensitive( false ); - remove_symbol->set_sensitive( false ); - } + } + // Symbol must be from Current Document (this method of checking should be language independent). + if( !symbol_document ) { + // Symbol must be from Current Document (this method of + // checking should be language independent). + symbol_document = current_document; + add_symbol->set_sensitive( true ); + remove_symbol->set_sensitive( true ); + } else { + add_symbol->set_sensitive( false ); + remove_symbol->set_sensitive( false ); } return symbol_document; } -- cgit v1.2.3 From e0c8791758a7295b3c987234e3ec1aacce006fc1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Fri, 17 Nov 2017 00:25:30 +0100 Subject: Fix a bug pointed by suv when the title of a symbol has duplicates --- src/ui/dialog/symbols.cpp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index c552a0bba..609edee2e 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -434,8 +434,8 @@ void SymbolsDialog::rebuild() { //We are not in search all docs if (search->get_text() != _("Searching...") && - search->get_text() != _("Loading all symbols...") && - search->get_text() != _("Searching....") ) + search->get_text() != _("Loading all symbols...") && + search->get_text() != _("Searching....") ) { search_str = ""; search->set_text(""); @@ -572,17 +572,17 @@ SPDocument* SymbolsDialog::selectedSymbols() { SPDocument* symbol_document = symbol_sets[doc_title]; if( !symbol_document ) { symbol_document = getSymbolsSet(doc_title).second; - } - // Symbol must be from Current Document (this method of checking should be language independent). - if( !symbol_document ) { - // Symbol must be from Current Document (this method of - // checking should be language independent). - symbol_document = current_document; - add_symbol->set_sensitive( true ); - remove_symbol->set_sensitive( true ); - } else { - add_symbol->set_sensitive( false ); - remove_symbol->set_sensitive( false ); + // Symbol must be from Current Document (this method of checking should be language independent). + if( !symbol_document ) { + // Symbol must be from Current Document (this method of + // checking should be language independent). + symbol_document = current_document; + add_symbol->set_sensitive( true ); + remove_symbol->set_sensitive( true ); + } else { + add_symbol->set_sensitive( false ); + remove_symbol->set_sensitive( false ); + } } return symbol_document; } @@ -890,9 +890,18 @@ void SymbolsDialog::symbolsInDocRecursive (SPObject *r, std::maptitle()) { Glib::ustring current = symbol_set->get_active_text(); if (current == ALLDOCS) { - l[doc_title + r->title()] = std::make_pair(doc_title,dynamic_cast(r)); + if (l.count(doc_title + r->title()) > 0) { + l[doc_title + r->title() + Glib::ustring("_") + r->getId()] = std::make_pair(doc_title,dynamic_cast(r)); + } else { + l[doc_title + r->title()] = std::make_pair(doc_title,dynamic_cast(r)); + } } else { - l[r->title()] = std::make_pair(doc_title,dynamic_cast(r)); + if (l.count(r->title()) > 0) { + l[r->title() + Glib::ustring("_") + r->getId()] = std::make_pair(doc_title,dynamic_cast(r)); + } else { + l[r->title()] = std::make_pair(doc_title,dynamic_cast(r)); + } + } } else { Glib::ustring id = r->getAttribute("id"); -- cgit v1.2.3 From fed7beb3ceaa2321040d2757788e27f429f61854 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Fri, 17 Nov 2017 11:31:35 +0100 Subject: Code simplification --- src/ui/dialog/symbols.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 609edee2e..fda1825da 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -887,25 +887,11 @@ void SymbolsDialog::symbolsInDocRecursive (SPObject *r, std::map(r)) { + Glib::ustring id = r->getAttribute("id"); if(r->title()) { - Glib::ustring current = symbol_set->get_active_text(); - if (current == ALLDOCS) { - if (l.count(doc_title + r->title()) > 0) { - l[doc_title + r->title() + Glib::ustring("_") + r->getId()] = std::make_pair(doc_title,dynamic_cast(r)); - } else { - l[doc_title + r->title()] = std::make_pair(doc_title,dynamic_cast(r)); - } - } else { - if (l.count(r->title()) > 0) { - l[r->title() + Glib::ustring("_") + r->getId()] = std::make_pair(doc_title,dynamic_cast(r)); - } else { - l[r->title()] = std::make_pair(doc_title,dynamic_cast(r)); - } - - } + l[doc_title + r->title() + id] = std::make_pair(doc_title,dynamic_cast(r)); } else { - Glib::ustring id = r->getAttribute("id"); - l[Glib::ustring(_("Symbol without title ")) + id] = std::make_pair(doc_title,dynamic_cast(r)); + l[Glib::ustring(_("notitle_")) + id] = std::make_pair(doc_title,dynamic_cast(r)); } } for (auto& child: r->children) { -- cgit v1.2.3 From b4df140282079eef811de4429ef29d60285bac03 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 17 Nov 2017 13:45:08 +0100 Subject: Add missing mappings. Note: This file does not appear to be used but is useful for scripts that extract icons from old files which contain the entire set of icons. Actual mapping is handled in 0.92.x and earlier by the now removed src/widgets/icon.cpp file. --- src/widgets/mappings.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/mappings.xml b/src/widgets/mappings.xml index 089bf76ea..3ea9cb3c2 100644 --- a/src/widgets/mappings.xml +++ b/src/widgets/mappings.xml @@ -220,7 +220,17 @@ - + + + + + + + + + + + @@ -258,11 +268,13 @@ + + -- cgit v1.2.3 From 73c2b3f8807b5230fe0c32f6168edfa5392be7da Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Fri, 17 Nov 2017 13:12:00 +0100 Subject: Fix memleaks and double call to title() in a recursive function in Symbols Dialog --- src/ui/dialog/symbols.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index fda1825da..7b34aa23d 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -888,11 +888,13 @@ void SymbolsDialog::symbolsInDocRecursive (SPObject *r, std::map(r)) { Glib::ustring id = r->getAttribute("id"); - if(r->title()) { - l[doc_title + r->title() + id] = std::make_pair(doc_title,dynamic_cast(r)); + gchar * title = r->title(); + if(title) { + l[doc_title + title + id] = std::make_pair(doc_title,dynamic_cast(r)); } else { l[Glib::ustring(_("notitle_")) + id] = std::make_pair(doc_title,dynamic_cast(r)); } + g_free(title); } for (auto& child: r->children) { symbolsInDocRecursive(&child, l, doc_title); -- cgit v1.2.3 From 666b9584b216d5a662dc60b8245fec8014ee164a Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Fri, 17 Nov 2017 13:18:12 +0100 Subject: More memleaks fixes --- src/ui/dialog/symbols.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 7b34aa23d..6add2b73d 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -614,9 +614,11 @@ Glib::ustring SymbolsDialog::selectedSymbolDocTitle() { Glib::ustring SymbolsDialog::documentTitle(SPDocument* symbol_doc) { if (symbol_doc) { SPRoot * root = symbol_doc->getRoot(); - if (root->title()) { - return ellipsize(Glib::ustring(root->title()), 33); + gchar * title = root->title(); + if (title) { + return ellipsize(Glib::ustring(title), 33); } + g_free(title); } Glib::ustring current = symbol_set->get_active_text(); if (current == CURRENTDOC) { @@ -1013,8 +1015,8 @@ bool SymbolsDialog::callbackSymbols(){ Glib::ustring doc_title = symbol_data->second.first; SPSymbol * symbol = symbol_data->second.second; counter_symbols ++; - gchar const *symbol_title_char = symbol->title(); - gchar const *symbol_desc_char = symbol->description(); + gchar *symbol_title_char = symbol->title(); + gchar *symbol_desc_char = symbol->description(); bool found = false; if (symbol_title_char) { Glib::ustring symbol_title = Glib::ustring(symbol_title_char).lowercase(); @@ -1039,6 +1041,8 @@ bool SymbolsDialog::callbackSymbols(){ symbol_data = l.erase(l.begin()); //to get more items and best performance int modulus = number_symbols > 200 ? 50 : (number_symbols/4); + g_free(symbol_title_char); + g_free(symbol_desc_char); if (modulus && counter_symbols % modulus == 0 && !l.empty()) { return true; } -- cgit v1.2.3