summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2013-07-06 20:26:52 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2013-07-06 20:27:47 (GMT)
commit1b58c1eea8be8619e428f9995a4cb8ef1ec04941 (patch)
treeb93f53bd28c6bbe7c2f56400e8e8de7b461c4a5b
parent74b8b2c85bc2cce5bb4c712ca731e2a0b64ba814 (diff)
downloadpowder-1b58c1eea8be8619e428f9995a4cb8ef1ec04941.zip
powder-1b58c1eea8be8619e428f9995a4cb8ef1ec04941.tar.gz
Fix #127, threads should not be cancelled after being joined
-rw-r--r--src/gui/preview/PreviewModel.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/preview/PreviewModel.cpp b/src/gui/preview/PreviewModel.cpp
index 07c4f1f..9783ef1 100644
--- a/src/gui/preview/PreviewModel.cpp
+++ b/src/gui/preview/PreviewModel.cpp
@@ -347,9 +347,21 @@ void PreviewModel::Update()
}
PreviewModel::~PreviewModel() {
- pthread_cancel(updateSaveDataThread);
- pthread_cancel(updateSaveInfoThread);
- pthread_cancel(updateSaveCommentsThread);
+ if (updateSaveDataWorking)
+ {
+ pthread_cancel(updateSaveDataThread);
+ pthread_join(updateSaveDataThread, NULL);
+ }
+ if (updateSaveInfoWorking)
+ {
+ pthread_cancel(updateSaveInfoThread);
+ pthread_join(updateSaveInfoThread, NULL);
+ }
+ if (updateSaveCommentsWorking)
+ {
+ pthread_cancel(updateSaveCommentsThread);
+ pthread_join(updateSaveCommentsThread, NULL);
+ }
if(save)
delete save;
if(saveComments)