r24211 by jghali - Fix QList::reserve() call a bit too optimistic about required memory

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 8 17:41:35 UTC 2020


Author: jghali
Date: Sun Nov  8 17:41:35 2020
New Revision: 24211

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24211
Log:
Fix QList::reserve() call a bit too optimistic about required memory

Modified:
    trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp

Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24211&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp	Sun Nov  8 17:41:35 2020
@@ -1551,13 +1551,14 @@
 
 void XfigPlug::resortItems()
 {
-	int ac = m_Doc->Items->count();
 	QList<PageItem*> itemList;
-	itemList.reserve(ac);
-	for (int as = oldDocItemCount; as < ac; ++as)
+	int newItemCount = m_Doc->Items->count();
+	itemList.reserve(newItemCount - oldDocItemCount);
+	for (int as = oldDocItemCount; as < newItemCount; ++as)
 	{
 		itemList.append(m_Doc->Items->takeAt(oldDocItemCount));
 	}
+
 	QList<int> keylist = depthMap.uniqueKeys();
 	int keysCount = keylist.count();
 	int currentLayer = 0;




More information about the scribus-commit mailing list