Commits

Gordon Tisher committed 2f86d29

fix #34: copy and paste

  • Participants
  • Parent commits 6e7dc19

Comments (0)

Files changed (3)

File src/asyncLife/lifewidget.cpp

 
 LifeWidget::~LifeWidget()
 {
+    step_c.waitForFinished();
+    step_b.waitForFinished();
+    step_a.waitForFinished();
+
     delete board;
 }
 
 
     // trigger repaint
     if (this->autoStep)
-        step();
+    {
+        step_c.waitForFinished();
+        step_b.waitForFinished();
+        step_a.waitForFinished();
+
+        step_a = this->board->stepAsync();
+//        step_b = this->board->stepAsync();
+//        step_c = this->board->stepAsync();
+        update();
+
+    }
 } // LifeWidget::paintEvent()
 
 void LifeWidget::step()
 void LifeWidget::start()
 {
     this->autoStep = true;
-    step();
+    step_a = this->board->stepAsync();
+//    step_b = this->board->stepAsync();
+//    step_c = this->board->stepAsync();
+    update();
 }
 
 void LifeWidget::stop()

File src/asyncLife/lifewidget.h

 #define LIFEWIDGET_H
 
 #include <QWidget>
+#include <QFuture>
 
 class LifeBoard;
 
     bool autoStep;
     LifeBoard *board;
 
+    QFuture<void> step_a, step_b, step_c;
+
 public:
     LifeWidget(QWidget *parent = 0);
     virtual ~LifeWidget();

File src/automata/automaton.h

                 QVector<TState> *temp_neighbors = tni.data;
                 TState *temp_ptr = 0;
 
-                bool do_update = true;
+                bool do_update = false;
                 {
                     QReadLocker read_lock(&_network_lock);
 
             }
             else
             {
-                bool do_update;
+                bool do_update = false;
                 {
                     QReadLocker read_lock(&_network_lock);
                     do_update = isReady(index, state.r);