summaryrefslogtreecommitdiffstats
path: root/evolvotron/build/patches/evolvotron-0.7.1_qt5_crash.patch
blob: f8bd365cd9670d1609af16b5bf0fb43734a52962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Index: evolvotron-0.7.1/libevolvotron/mutatable_image_computer_farm.cpp
===================================================================
--- evolvotron-0.7.1.orig/libevolvotron/mutatable_image_computer_farm.cpp
+++ evolvotron-0.7.1/libevolvotron/mutatable_image_computer_farm.cpp
@@ -72,19 +72,20 @@ void MutatableImageComputerFarm::fasttra
 {
   QMutexLocker lock(&_mutex);
   
-  // \todo: Inefficient starting search again each time.  Some problem with erase otherwise though, but might have been task abort mem leak.
-  TodoQueue::iterator it;
-  while (
-	 (
-	  it=std::find_if(_todo.begin(),_todo.end(),predicate_aborted)
-	  )
-	 !=
-	 _todo.end()
-	 )
-    {
-      _done[(*it)->display()].insert(*it);
-      _todo.erase(it);
-    }  
+  TodoQueue::iterator it = _todo.begin();
+
+  while (it != _todo.end())
+    {
+      if ((*it)->aborted())
+	{
+	  _done[(*it)->display()].insert(*it);
+	  it = _todo.erase(it);
+	}
+      else
+	{
+	  it++;
+	}
+    }
 }
 
 void MutatableImageComputerFarm::push_todo(const boost::shared_ptr<MutatableImageComputerTask>& task)
@@ -214,7 +215,9 @@ void MutatableImageComputerFarm::abort_f
       if ((*it)->display()==disp)
 	{
 	  (*it)->abort();
-	  _todo.erase(it);
+	  it = _todo.erase(it);
+	  if (it == _todo.end())
+	    break;
 	}
     }
   
@@ -234,7 +237,9 @@ void MutatableImageComputerFarm::abort_f
 	  if ((*it1)->display()==disp)
 	    {
 	      (*it1)->abort();
-	      q.erase(it1);
+	      it1 = q.erase(it1);
+	      if (it1 == q.end())
+		break;
 	    }
 	}
     }