r24777 by jghali - #16697: Avoid modifying container while iterating it

scribus-commit scribus-commit at lists.scribus.net
Tue Dec 7 22:40:23 UTC 2021


Author: jghali
Date: Tue Dec  7 22:40:23 2021
New Revision: 24777

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24777
Log:
#16697: Avoid modifying container while iterating it

Modified:
    trunk/Scribus/scribus/langmgr.cpp

Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24777&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp	(original)
+++ trunk/Scribus/scribus/langmgr.cpp	Tue Dec  7 22:40:23 2021
@@ -20,6 +20,7 @@
  ***************************************************************************/
  
 #include <iostream>
+
 #include <QDebug>
 #include <QDir>
 #include <QFile>
@@ -1030,16 +1031,14 @@
 		QDir dictLocation(dictionaryPaths.at(i));
 		QStringList dictFilters("*.dic");
 		QStringList dictList(dictLocation.entryList(dictFilters, QDir::Files, QDir::Name));
-		dictList.replaceInStrings(".dic","");
+		dictList.replaceInStrings(".dic", "");
+		dictList.removeDuplicates();
 
 		//Ensure we have aff+dic file pairs, remove any hyphenation dictionaries from the list
 		for (const QString& dictName : qAsConst(dictList))
 		{
 			if (!QFile::exists(dictionaryPaths.at(i) + dictName + ".aff"))
-			{
-				dictList.removeAll(dictName);
 				continue;
-			}
 				
 			if (dictionaryMap.contains(dictName))
 				continue;




More information about the scribus-commit mailing list