r24617 by jghali - #16542: Scribus crashes after undoing "Unlink Text Frames and Cut Text"

scribus-commit scribus-commit at lists.scribus.net
Fri Apr 9 17:41:04 UTC 2021


Author: jghali
Date: Fri Apr  9 17:41:04 2021
New Revision: 24617

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24617
Log:
#16542: Scribus crashes after undoing "Unlink Text Frames and Cut Text"

Modified:
    trunk/Scribus/scribus/pageitem.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24617&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Fri Apr  9 17:41:04 2021
@@ -1328,18 +1328,18 @@
 //but copy or cut its content from itemText
 void PageItem::unlinkWithText()
 {
-	PageItem* Next = m_nextBox;
-	PageItem* Prev = m_backBox;
+	PageItem* next = m_nextBox;
+	PageItem* prev = m_backBox;
 	int length = itemText.length();
 
 	if (this->invalid)
 		layout();
 
 	//unlink first frame in chain
-	if (Prev == nullptr)
-	{
-		if (Next->invalid)
-			Next->layout();
+	if (prev == nullptr)
+	{
+		if (next->invalid)
+			next->layout();
 		if (lastInFrame() < length -1)
 		{
 			StoryText content(m_Doc);
@@ -1347,8 +1347,8 @@
 			content.insert(0, itemText, true);
 			itemText.removeSelection();
 			unlink(false);
-			Next->itemText.insert(0, content);
-			Next->update();
+			next->itemText.insert(0, content);
+			next->update();
 		}
 		else
 		{
@@ -1357,13 +1357,13 @@
 	}
 	else
 	{
-		if (Prev->invalid)
-			Prev->layout();
+		if (prev->invalid)
+			prev->layout();
 		itemText.select(firstInFrame(), length - firstInFrame());
 		StoryText content(m_Doc);
 		content.insert(0, itemText, true);
 		itemText.removeSelection();
-		Prev->unlink(false);
+		prev->unlink(false);
 		itemText.insert(0, content);
 		update();
 	}
@@ -1371,7 +1371,8 @@
 	{
 		ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::UnlinkTextFrame);
 		is->set("UNLINK_TEXT_FRAME");
-		is->setItem(qMakePair(Prev, Next));
+		is->set("CUT_TEXT", true);
+		is->setItem(qMakePair(prev, next));
 		undoManager->action(this, is);
 	}
 }




More information about the scribus-commit mailing list