r18331 by jghali - #11607: Crash when deleting pages

scribus-commit scribus-commit at lists.scribus.net
Wed Jun 19 20:53:56 UTC 2013


Author: jghali
Date: Wed Jun 19 20:53:55 2013
New Revision: 18331

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18331
Log:
#11607: Crash when deleting pages

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18331&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Jun 19 20:53:55 2013
@@ -6183,7 +6183,7 @@
 	if (!isLoading())
 	{
 		undoManager->setUndoEnabled(false);
-		uint docItemsCount=Items->count();
+		uint docItemsCount = Items->count();
 		for (uint ite = 0; ite < docItemsCount; ++ite)
 		{
 			PageItem *item = Items->at(ite);
@@ -6194,21 +6194,32 @@
 				else
 					item->OwnPage = OnPage(item);
 			}
+			else if (moveObjects)
+			{
+				oldPg = pageTable[item->OwnPage];
+				item->moveBy(-oldPg.oldXO + Pages->at(oldPg.newPg)->xOffset(), -oldPg.oldYO + Pages->at(oldPg.newPg)->yOffset());
+				item->OwnPage = static_cast<int>(oldPg.newPg);
+				if (item->isGroup())
+				{
+					QList<PageItem*> groupItems = item->groupItemList;
+					while (groupItems.count() > 0)
+					{
+						PageItem* groupItem = groupItems.takeAt(0);
+						if (groupItem->isGroup())
+							groupItems += groupItem->groupItemList;
+						if (groupItem->OwnPage < 0)
+							continue;
+						oldPg = pageTable[item->OwnPage];
+						groupItem->OwnPage = static_cast<int>(oldPg.newPg);
+					}
+				}
+			}
 			else
 			{
-				if (moveObjects)
-				{
-					oldPg = pageTable[item->OwnPage];
-					item->moveBy(-oldPg.oldXO + Pages->at(oldPg.newPg)->xOffset(), -oldPg.oldYO + Pages->at(oldPg.newPg)->yOffset());
-					item->OwnPage = static_cast<int>(oldPg.newPg);
-				}
+				if (item->isGroup())
+					GroupOnPage(item);
 				else
-				{
-					if (item->isGroup())
-						GroupOnPage(item);
-					else
-						item->OwnPage = OnPage(item);
-				}
+					item->OwnPage = OnPage(item);
 			}
 			item->setRedrawBounding();
 		}




More information about the scribus-commit mailing list