diff --git a/src/gui/preview/PreviewModel.cpp b/src/gui/preview/PreviewModel.cpp index 07c4f1fbe..9783ef195 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)