r21440 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 7 16:20:25 UTC 2016


Author: jghali
Date: Wed Sep  7 16:20:25 2016
New Revision: 21440

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21440
Log:
#14283: Crash: EXCEPTION_STACK_OVERFLOW

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21440&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Wed Sep  7 16:20:25 2016
@@ -1273,20 +1273,22 @@
 {
 // 	qDebug()<<"==Layout==" << itemName() ;
 // 	printBacktrace(24);
-	if (BackBox != NULL && BackBox->invalid) {
+	if (BackBox != NULL) {
 //		qDebug("textframe: len=%d, going back", itemText.length());
-		// Why that invalid = false here? Calling prevInChain->layout() does
-		// not ensure that this box will be layouted
-		// invalid = false;
-		PageItem_TextFrame* prevInChain = dynamic_cast<PageItem_TextFrame*>(BackBox);
-		while (prevInChain && prevInChain->invalid)
-		{
-			if (!prevInChain->BackBox || !prevInChain->BackBox->invalid)
-				break;
+		PageItem_TextFrame* firstInvalid = NULL;
+		PageItem_TextFrame* prevInChain  = dynamic_cast<PageItem_TextFrame*>(BackBox);
+		while (prevInChain)
+		{
+			if (prevInChain->invalid)
+				firstInvalid = prevInChain;
 			prevInChain = dynamic_cast<PageItem_TextFrame*>(prevInChain->BackBox);
 		}
-		if (prevInChain && prevInChain->invalid)
-			prevInChain->layout();
+		PageItem_TextFrame* nextInChain = firstInvalid;
+		while (nextInChain && (nextInChain != this))
+		{
+			nextInChain->layout();
+			nextInChain = dynamic_cast<PageItem_TextFrame*>(nextInChain->NextBox);
+		}
 		// #9592 : warning, BackBox->layout() may not layout BackBox next box
 		if (!invalid)
 			return;
@@ -3068,25 +3070,18 @@
 	PageItem_TextFrame * next = dynamic_cast<PageItem_TextFrame*>(NextBox);
 	if (next != NULL)
 	{
-		next->invalid = true;
-		next->firstChar = MaxChars;
 		if (itemText.cursorPosition() > signed(MaxChars))
 		{
 			int nCP = itemText.cursorPosition();
-//			CPos = MaxChars;
 			if (m_Doc->appMode == modeEdit)
-			{
-				//							OwnPage->Deselect(true);
 				next->itemText.setCursorPosition( qMax(nCP, signed(MaxChars)) );
-				//							Doc->currentPage = NextBox->OwnPage;
-				//							NextBox->OwnPage->SelectItemNr(NextBox->ItemNr);
-//				qDebug("textframe: len=%d, leaving relayout in editmode && Tinput", itemText.length());
-				return;
-			}
-		}
-		// relayout next frame
-//		qDebug("textframe: len=%d, going to next", itemText.length());
-		next->layout();
+		}
+		while (next)
+		{
+			next->invalid   = true;
+			next->firstChar = MaxChars;
+			next = dynamic_cast<PageItem_TextFrame*>(next->NextBox);
+		}
 	}
 //	qDebug("textframe: len=%d, done relayout (no room %d)", itemText.length(), MaxChars);
 	itemText.blockSignals(false);




More information about the scribus-commit mailing list