Fix problems that occurred when multiple threads were trying to read/convert files at the same time (ie: indexing and previewing threads in the GUI calling internfile()). Either get rid of or lock-protect all shared data, eliminate misc initialization possible conflicts by using static initializers. Hopefuly closes issue #51
This commit is contained in:
@@ -63,7 +63,13 @@ using namespace std;
|
||||
#define deleteZ(X) {delete X;X = 0;}
|
||||
#endif
|
||||
|
||||
FsIndexer::FsIndexer(RclConfig *cnf, Rcl::Db *db, DbIxStatusUpdater *updfunc)
|
||||
: m_config(cnf), m_db(db), m_updater(updfunc), m_missing(new FIMissingStore)
|
||||
{
|
||||
m_havelocalfields = m_config->hasNameAnywhere("localfields");
|
||||
}
|
||||
FsIndexer::~FsIndexer() {
|
||||
delete m_missing;
|
||||
}
|
||||
|
||||
bool FsIndexer::init()
|
||||
@@ -121,7 +127,7 @@ bool FsIndexer::index()
|
||||
}
|
||||
|
||||
string missing;
|
||||
FileInterner::getMissingDescription(missing);
|
||||
FileInterner::getMissingDescription(m_missing, missing);
|
||||
if (!missing.empty()) {
|
||||
LOGINFO(("FsIndexer::index missing helper program(s):\n%s\n",
|
||||
missing.c_str()));
|
||||
@@ -359,6 +365,7 @@ FsIndexer::processone(const std::string &fn, const struct stat *stp,
|
||||
// indexallfilenames is not set
|
||||
return FsTreeWalker::FtwOk;
|
||||
}
|
||||
interner.setMissingStore(m_missing);
|
||||
|
||||
// File name transcoded to utf8 for indexing.
|
||||
string charset = m_config->getDefCharset(true);
|
||||
|
||||
@@ -26,6 +26,7 @@ using std::list;
|
||||
#include "rcldb.h"
|
||||
|
||||
class DbIxStatusUpdater;
|
||||
class FIMissingStore;
|
||||
|
||||
/** Index selected parts of the file system
|
||||
|
||||
@@ -45,12 +46,7 @@ class FsIndexer : public FsTreeWalkerCB {
|
||||
* @param cnf Configuration data
|
||||
* @param updfunc Status updater callback
|
||||
*/
|
||||
FsIndexer(RclConfig *cnf, Rcl::Db *db, DbIxStatusUpdater *updfunc = 0)
|
||||
: m_config(cnf), m_db(db), m_updater(updfunc)
|
||||
{
|
||||
m_havelocalfields = m_config->hasNameAnywhere("localfields");
|
||||
}
|
||||
|
||||
FsIndexer(RclConfig *cnf, Rcl::Db *db, DbIxStatusUpdater *updfunc = 0);
|
||||
virtual ~FsIndexer();
|
||||
|
||||
/**
|
||||
@@ -79,6 +75,7 @@ class FsIndexer : public FsTreeWalkerCB {
|
||||
string m_reason;
|
||||
DbIxStatusUpdater *m_updater;
|
||||
list<string> m_tdl;
|
||||
FIMissingStore *m_missing;
|
||||
|
||||
// The configuration can set attribute fields to be inherited by
|
||||
// all files in a file system area. Ie: set "rclaptg = thunderbird"
|
||||
|
||||
Reference in New Issue
Block a user