r22137 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Mon Aug 21 12:16:50 UTC 2017
Author: jghali
Date: Mon Aug 21 12:16:50 2017
New Revision: 22137
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22137
Log:
fix potential crash when deleting gradients or patterns from Colors And Fills dialog
Modified:
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22137&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Mon Aug 21 12:16:50 2017
@@ -1419,40 +1419,44 @@
m_docCellStyles[i].replaceNamedResources(newNames);
}
- QHash<QString,ScPattern>::Iterator it;
- for (it = docPatterns.begin(); it != docPatterns.end(); ++it)
+ QHash<QString,ScPattern>::Iterator it = docPatterns.begin();
+ while (it != docPatterns.end())
{
if (newNames.patterns().contains(it.key()))
- docPatterns.erase(it);
- else
- {
- ScPattern pa = *it;
- for (int o = 0; o < pa.items.count(); o++)
- {
- pa.items.at(o)->replaceNamedResources(newNames);
- }
- }
- }
-
- QHash<QString,VGradient>::Iterator itg;
- for (itg = docGradients.begin(); itg != docGradients.end(); ++itg)
+ {
+ it = docPatterns.erase(it);
+ continue;
+ }
+
+ ScPattern pa = *it;
+ for (int o = 0; o < pa.items.count(); o++)
+ {
+ pa.items.at(o)->replaceNamedResources(newNames);
+ }
+ ++it;
+ }
+
+ QHash<QString,VGradient>::Iterator itg = docGradients.begin();
+ while (itg != docGradients.end())
{
if (newNames.gradients().contains(itg.key()))
- docGradients.erase(itg);
- else
- {
- QMap<QString,QString>::ConstIterator itc;
- QList<VColorStop*> cstops = itg.value().colorStops();
- for (uint cst = 0; cst < itg.value().Stops(); ++cst)
- {
- itc = newNames.colors().find(cstops.at(cst)->name);
- if (itc != newNames.colors().end())
- {
- if (*itc != CommonStrings::None)
- cstops.at(cst)->name = *itc;
- }
- }
- }
+ {
+ itg = docGradients.erase(itg);
+ continue;
+ }
+
+ QMap<QString,QString>::ConstIterator itc;
+ QList<VColorStop*> cstops = itg.value().colorStops();
+ for (uint cst = 0; cst < itg.value().Stops(); ++cst)
+ {
+ itc = newNames.colors().find(cstops.at(cst)->name);
+ if (itc != newNames.colors().end())
+ {
+ if (*itc != CommonStrings::None)
+ cstops.at(cst)->name = *itc;
+ }
+ }
+ ++itg;
}
if (newNames.colors().count() > 0 || newNames.fonts().count() > 0)
More information about the scribus-commit
mailing list