diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-01-20 14:02:38 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-01-20 14:02:38 -0200 |
commit | f7eb7c15c2e4a1ec40d44d887383ee21f7cdb579 (patch) | |
tree | fae0619d62cd5a4ff5d6ca0d12f423ba6c6faaba /examples | |
parent | 777286a47cbee3439e439bb2cfa26bd5262c519c (diff) |
Fixes the last fix of mandelbrot example, almost the same fix.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/threads/mandelbrot.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/examples/threads/mandelbrot.py b/examples/threads/mandelbrot.py index 85621d7..5d04ff5 100755 --- a/examples/threads/mandelbrot.py +++ b/examples/threads/mandelbrot.py @@ -56,6 +56,14 @@ class RenderThread(QtCore.QThread): for i in range(RenderThread.ColormapSize): self.colormap.append(self.rgbFromWaveLength(380.0 + (i * 400.0 / RenderThread.ColormapSize))) + def stop(self): + self.mutex.lock() + self.abort = True + self.condition.wakeOne() + self.mutex.unlock() + + self.wait() + def render(self, centerX, centerY, scaleFactor, resultSize): locker = QtCore.QMutexLocker(self.mutex) @@ -307,7 +315,6 @@ if __name__ == "__main__": app = QtGui.QApplication(sys.argv) widget = MandelbrotWidget() widget.show() - res = app.exec_() - widget.thread.abort = True - widget.thread.wait() - sys.exit(res) + r = app.exec_() + widget.thread.stop() + sys.exit(r) |