summaryrefslogtreecommitdiffstats
path: root/smdirwatcher.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-07-29 10:08:33 +0200
committerArno <am@disconnect.de>2013-07-29 10:08:33 +0200
commit06cfadc8386aec27b9c7c43486fc0b057e9fb022 (patch)
treeca0343db7f3363fb35bd4fc0ea72779651e0361e /smdirwatcher.h
parent28c7436a71910aabcc37945255fb577f7a032f0d (diff)
downloadSheMov-06cfadc8386aec27b9c7c43486fc0b057e9fb022.tar.gz
SheMov-06cfadc8386aec27b9c7c43486fc0b057e9fb022.tar.bz2
SheMov-06cfadc8386aec27b9c7c43486fc0b057e9fb022.zip
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.
Diffstat (limited to 'smdirwatcher.h')
-rw-r--r--smdirwatcher.h4
1 files changed, 3 insertions, 1 deletions
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<QPair<QString, SmDirWatcher::DWEvent> > *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;
};