r25035 by craig - Fix crash risk with duplicate iterator usage, and code clean a little

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 16 23:08:32 UTC 2022


Author: craig
Date: Wed Mar 16 23:08:32 2022
New Revision: 25035

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25035
Log:
Fix crash risk with duplicate iterator usage, and code clean a little

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25035&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Wed Mar 16 23:08:32 2022
@@ -2844,16 +2844,15 @@
 	{
 		QMap<QString,BibView::Elem>::Iterator it;
 		it = scrapbookPalette->tempBView->objectMap.end();
-		it--;
 		QString strippedName;
-		for (int m = 0; m < max; ++m)
-		{
+		for (int i = 0; i < max; ++i)
+		{
+			it--;
 			strippedName = it.key();
 			QPixmap pm = it.value().Preview;
-			scrRecentPasteActions.insert(strippedName, new ScrAction(ScrAction::RecentPaste, pm, QString(), QString("&%1 %2").arg(m+1).arg(strippedName), QKeySequence(), this, it.key()));
+			scrRecentPasteActions.insert(strippedName, new ScrAction(ScrAction::RecentPaste, pm, QString(), QString("&%1 %2").arg(i + 1).arg(strippedName), QKeySequence(), this, strippedName));
 			connect( scrRecentPasteActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(pasteRecent(QString)) );
 			scrMenuMgr->addMenuItemString(strippedName, "EditPasteRecent");
-			it--;
 		}
 		scrMenuMgr->addMenuItemStringsToRememberedMenu("EditPasteRecent", scrRecentPasteActions);
 	}




More information about the scribus-commit mailing list