recollindex threads: reset the config pointer when retrieving handler from cache. Seems to have been the cause of the crashes

This commit is contained in:
Jean-Francois Dockes 2012-11-30 19:34:19 +01:00
parent 4afde68f9e
commit a8f410606d
3 changed files with 11 additions and 1 deletions

View File

@ -21,6 +21,8 @@
#include <set>
#include <map>
class RclConfig;
namespace Dijon
{
class Filter;
@ -54,7 +56,7 @@ namespace Dijon
Filter(const std::string &mime_type) : m_mimeType(mime_type) {}
/// Destroys the filter.
virtual ~Filter() {}
virtual void setConfig(RclConfig *) = 0;
// Enumerations.

View File

@ -315,6 +315,10 @@ Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg,
out:
if (h) {
h->set_property(Dijon::Filter::DEFAULT_CHARSET, cfg->getDefCharset());
// In multithread context, and in case this handler is out
// from the cache, it may have a config pointer belonging to
// another thread. Fix it.
h->setConfig(cfg);
}
return h;
}

View File

@ -36,6 +36,10 @@ public:
m_forPreview(false), m_havedoc(false)
{}
virtual ~RecollFilter() {}
virtual void setConfig(RclConfig *config)
{
m_config = config;
}
virtual bool set_property(Properties p, const string &v) {
switch (p) {
case DJF_UDI: