From 06cfadc8386aec27b9c7c43486fc0b057e9fb022 Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 29 Jul 2013 10:08:33 +0200 Subject: Prevent datacollector from running when operating on files This stuff was racy from the beginning. It could happen that the model got reset after we fetched the selected indexes. Add a mutex and lock it before operating on the file view. Hopefully this will many, if not all random crashes. --- smdirwatcher.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'smdirwatcher.h') diff --git a/smdirwatcher.h b/smdirwatcher.h index 77d0d97..dcfc714 100644 --- a/smdirwatcher.h +++ b/smdirwatcher.h @@ -1,4 +1,4 @@ - /* +/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version @@ -54,6 +54,7 @@ class SmDataColletor : public QThread { public: explicit SmDataColletor(const int numFields, QObject *parent = 0); void init(QSemaphore *set, QSemaphore *get, QQueue > *data); + QMutex &hold() { return mHoldMx; } public slots: void setCheckForPresent(bool present); @@ -77,6 +78,7 @@ class SmDataColletor : public QThread { bool mCheckForPresent; bool mCancel; QMutex mCheckForPresentMx; + QMutex mHoldMx; QSqlQuery *mPicPresentQ; QSqlQuery *mMovPresentQ; }; -- cgit v1.2.3-70-g09d2