r22466 by jghali - #15248: After changing the "Hyphenation Character", Scribus crashes

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 5 22:42:52 UTC 2018


Author: jghali
Date: Thu Apr  5 22:42:52 2018
New Revision: 22466

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22466
Log:
#15248: After changing the "Hyphenation Character", Scribus crashes

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22466&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Thu Apr  5 22:42:52 2018
@@ -8001,7 +8001,7 @@
 {
 	CharStyle newStyle;
 	newStyle.setHyphenWordMin(wordMin);
-	itemSelection_ApplyCharStyle(newStyle, customSelection, "HYPHENWORDMIN");
+	itemSelection_ApplyCharStyle(newStyle, customSelection, "HYPHEN_WORDMIN");
 }
 
 void ScribusDoc::itemSelection_SetHyphenConsecutiveLines(int consecutiveLines, Selection* customSelection)
@@ -8015,7 +8015,7 @@
 {
 	CharStyle newStyle;
 	newStyle.setHyphenChar(hyphenChar);
-	itemSelection_ApplyCharStyle(newStyle, customSelection);
+	itemSelection_ApplyCharStyle(newStyle, customSelection, "HYPHEN_CHAR");
 }
 
 void ScribusDoc::itemSelection_SetNamedCharStyle(const QString& name, Selection* customSelection)
@@ -9496,13 +9496,20 @@
 						UndoState* state = m_undoManager->getLastUndo();
 						ScItemState<QPair<CharStyle,CharStyle> > *is = NULL;
 						SimpleState *ss = NULL;
-						TransactionState *ts = dynamic_cast<TransactionState*>(state);
-						if (state && state->isTransaction())
+						TransactionState *ts = NULL;
+						while (state && state->isTransaction())
+						{
+							ts = dynamic_cast<TransactionState*>(state);
 							ss = dynamic_cast<SimpleState*>(ts->last());
-						if (ss && ss->get("ETEA") == ETEA)
+							state = ts->last();
+						}
+						if (ts && ss && ss->get("ETEA") == ETEA)
 						{
-							for (uint i=0; i < ts->sizet(); i++) {
-								is = dynamic_cast<ScItemState<QPair<CharStyle,CharStyle> > *>(ts->at(i));
+							for (int i = ts->sizet() - 1; i >= 0; --i)
+							{
+								is = dynamic_cast<ScItemState<QPair<CharStyle, CharStyle> > *>(ts->at(i));
+								if (!is || (is->get("ETEA") != ETEA))
+									break;
 								is->setItem(qMakePair(newStyle, is->getItem().second));
 							}
 						}




More information about the scribus-commit mailing list