forked from organicmaps/organicmaps
Fix SloynikEngine violation in shared ownership of index reader.
This commit is contained in:
parent
50b820f452
commit
3125725cc5
4 changed files with 12 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "guide_page.hpp"
|
||||
|
||||
#include "../words/sloynik_engine.hpp"
|
||||
|
||||
#include "../platform/platform.hpp"
|
||||
|
||||
#include <QtWebKit/QWebView>
|
||||
|
@ -29,6 +31,10 @@ GuidePageHolder::GuidePageHolder(QWidget * pParent)
|
|||
CreateEngine();
|
||||
}
|
||||
|
||||
GuidePageHolder::~GuidePageHolder()
|
||||
{
|
||||
}
|
||||
|
||||
void GuidePageHolder::showEvent(QShowEvent * e)
|
||||
{
|
||||
base_type::showEvent(e);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include "../words/sloynik_engine.hpp"
|
||||
|
||||
#include "../std/scoped_ptr.hpp"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
@ -22,6 +20,7 @@ namespace qt
|
|||
|
||||
public:
|
||||
GuidePageHolder(QWidget * pParent);
|
||||
virtual ~GuidePageHolder();
|
||||
|
||||
protected:
|
||||
void CreateEngine();
|
||||
|
|
|
@ -47,8 +47,10 @@ sl::SloynikEngine::SloynikEngine(string const & dictionaryPath,
|
|||
FileWriter stampWriter(stampPath);
|
||||
stampWriter.Write(&stamp[0], stamp.size() * sizeof(stamp[0]));
|
||||
}
|
||||
m_pIndexReader.reset(new FileReader(indexPath + ".idx"));
|
||||
m_pSortedIndex.reset(new sl::SortedIndex(*m_pDictionary, m_pIndexReader.get(), strFn));
|
||||
|
||||
// By VNG: SortedIndex takes ownership of index reader, so no need to store it here.
|
||||
//m_pIndexReader.reset(new FileReader(indexPath + ".idx"));
|
||||
m_pSortedIndex.reset(new sl::SortedIndex(*m_pDictionary, new FileReader(indexPath + ".idx"), strFn));
|
||||
}
|
||||
|
||||
sl::SloynikEngine::~SloynikEngine()
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
private:
|
||||
scoped_ptr<sl::Dictionary> m_pDictionary;
|
||||
scoped_ptr<FileReader> m_pIndexReader;
|
||||
//scoped_ptr<FileReader> m_pIndexReader;
|
||||
scoped_ptr<sl::SortedIndex> m_pSortedIndex;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue