r19328 by jghali - #12472: Changing from Single Page to Double Page layout may lead to crash

scribus-commit scribus-commit at lists.scribus.net
Mon Jul 7 21:16:39 UTC 2014


Author: jghali
Date: Mon Jul  7 21:16:39 2014
New Revision: 19328

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19328
Log:
#12472: Changing from Single Page to Double Page layout may lead to crash

Modified:
    trunk/Scribus/scribus/documentchecker.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19328&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Mon Jul  7 21:16:39 2014
@@ -73,28 +73,30 @@
 		pageError.clear();
 		if (checkerSettings.checkAppliedMasterDifferentSide)
 		{
-			PageLocation pageLoc=currDoc->locationOfPage(i);
-			int masterPageNumber = currDoc->MasterNames[currDoc->DocPages[i]->MPageNam];
-			int masterPageLocation=currDoc->MasterPages[masterPageNumber]->LeftPg;
-			bool error=0;
+			bool error = false;
+			int masterPageNumber = -1, masterPageLocation = -1;
+			PageLocation pageLoc = currDoc->locationOfPage(i);
+			masterPageNumber = currDoc->MasterNames.value(currDoc->DocPages[i]->MPageNam, -1);
+			if (masterPageNumber >= 0)
+				masterPageLocation = currDoc->MasterPages[masterPageNumber]->LeftPg;
 			if (currDoc->pagePositioning() == singlePage)
 			{
-				if (!(pageLoc==LeftPage && masterPageLocation==0))
-					error=1;
+				if ((pageLoc != LeftPage) || (masterPageLocation != 0))
+					error = true;
 			}
 			else
 			{
 				if (pageLoc==LeftPage && masterPageLocation==1)
-					error=0;
+					error = false;
 				else if (pageLoc==RightPage && masterPageLocation==0)
-					error=0;
+					error = false;
 				else if (pageLoc==MiddlePage && masterPageLocation==2)
-					error=0;
+					error = false;
 				else
-					error=1;
+					error = true;
 			}
 			if (error)
-				pageError.insert(AppliedMasterDifferentSide,0);
+				pageError.insert(AppliedMasterDifferentSide, 0);
 		}
 		if (pageError.count() != 0)
 			currDoc->pageErrors.insert(i, pageError);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19328&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Mon Jul  7 21:16:39 2014
@@ -2736,7 +2736,7 @@
 {
 	MasterNames.clear();
 	for (int a = 0; a < MasterPages.count(); ++a)
-		MasterNames[MasterPages.at(a)->pageName()] = MasterPages.at(a)->pageNr();
+		MasterNames[MasterPages.at(a)->pageName()] = a;
 }
 
 




More information about the scribus-commit mailing list