fixed: LDForge would crash if message log got full - the older lines would be removed with ::erase, which now expects an iterator because of the recent transition to QList. Why does QList::iterator allow 0 to be passed?

Fri, 18 Oct 2013 18:16:54 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 18 Oct 2013 18:16:54 +0300
changeset 512
adab82ab13a5
parent 511
c3787dbd6315
child 513
29eb671b34f6

fixed: LDForge would crash if message log got full - the older lines would be removed with ::erase, which now expects an iterator because of the recent transition to QList. Why does QList::iterator allow 0 to be passed?

src/gldraw.cpp file | annotate | diff | comparison | revisions
src/messagelog.cpp file | annotate | diff | comparison | revisions
--- a/src/gldraw.cpp	Fri Oct 18 18:12:23 2013 +0300
+++ b/src/gldraw.cpp	Fri Oct 18 18:16:54 2013 +0300
@@ -1791,12 +1791,12 @@
 
 		// Check the top and bottom rows
 		for (int i = 0; i < w && !filled; ++i)
-			if (imgdata[i] != white || imgdata[ ( (h - 1) * w) + i] != white)
+			if (imgdata[i] != white || imgdata[((h - 1) * w) + i] != white)
 				filled = true;
 
 		// Left and right edges
 		for (int i = 0; i < h && !filled; ++i)
-			if (imgdata[i * w] != white || imgdata[ (i * w) + (w - 1)] != white)
+			if (imgdata[i * w] != white || imgdata[(i * w) + w - 1] != white)
 				filled = true;
 
 		delete[] cap;
--- a/src/messagelog.cpp	Fri Oct 18 18:12:23 2013 +0300
+++ b/src/messagelog.cpp	Fri Oct 18 18:16:54 2013 +0300
@@ -74,7 +74,7 @@
 void MessageManager::addLine (str line)
 {	// If there's too many entries, pop the excess out
 	while (m_lines.size() >= g_maxMessages)
-		m_lines.erase (0);
+		m_lines.removeFirst();
 
 	m_lines << Line (line);
 

mercurial