r17415 by jghali - #10658 : Deleting masterpage triggers crash

scribus-commit scribus-commit at lists.scribus.net
Tue Apr 3 20:50:25 UTC 2012


Author: jghali
Date: Tue Apr  3 20:50:25 2012
New Revision: 17415

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17415
Log:
#10658 : Deleting masterpage triggers crash

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17415&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Apr  3 20:50:25 2012
@@ -2153,6 +2153,15 @@
 	ScPage* page = Pages->takeAt(pageNumber);
 	QString oldPageName(page->pageName());
 	delete page;
+	// #10658 : renumber masterpages and masterpage objects
+	// in order to avoid crash after masterpage deletion
+	for (int i = 0; i < MasterPages.count(); ++i)
+		MasterPages.at(i)->setPageNr(i);
+	for (int i = 0; i < MasterItems.count(); ++i)
+	{
+		if (MasterItems.at(i)->OwnPage > pageNumber)
+			MasterItems.at(i)->OwnPage--;
+	}
 	// remove the master page from the master page name list
 	//MasterNames.remove(page->PageNam);
 	/*CB TODO moved back to muster.cpp for now as this must happen after reformPages




More information about the scribus-commit mailing list