A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
graphlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.
[graphlib.git]
/
DrawingWindow.cpp
diff --git
a/DrawingWindow.cpp
b/DrawingWindow.cpp
index
eb14102
..
4e34d9e
100644
(file)
--- a/
DrawingWindow.cpp
+++ b/
DrawingWindow.cpp
@@
-3,6
+3,8
@@
#include <QThread>
#include <QTimerEvent>
#include <QThread>
#include <QTimerEvent>
+#include <iostream>
+
class DrawingWindow::DrawingThread: public QThread {
public:
DrawingThread(DrawingWindow &w, ThreadFunction f)
class DrawingWindow::DrawingThread: public QThread {
public:
DrawingThread(DrawingWindow &w, ThreadFunction f)
@@
-13,7
+15,7
@@
public:
void run()
{
void run()
{
-
exit(threadFunction(drawingWindow)
);
+
threadFunction(drawingWindow
);
}
private:
}
private:
@@
-59,13
+61,24
@@
void DrawingWindow::initialize(ThreadFunction fun, int width, int height)
thread = new DrawingThread(*this, fun);
thread_started = false;
thread = new DrawingThread(*this, fun);
thread_started = false;
+
+ mutex_enabled = true;
}
DrawingWindow::~DrawingWindow()
{
}
DrawingWindow::~DrawingWindow()
{
+ mutex.lock();
+ mutex_enabled = false;
+ mutex.unlock();
+ std::cerr << "A\n";
+ thread->terminate();
+ std::cerr << "B\n";
+ thread->wait();
+ std::cerr << "C\n";
delete thread;
delete painter;
delete image;
delete thread;
delete painter;
delete image;
+ std::cerr << "D\n";
}
void DrawingWindow::setColor(const QColor &color)
}
void DrawingWindow::setColor(const QColor &color)