forked from openkylin/ukui-search
修复队列未释放的问题.
This commit is contained in:
parent
a51795b8bf
commit
594371c274
|
@ -38,7 +38,7 @@ public:
|
|||
private:
|
||||
void copyData();
|
||||
//TODO: 这里是否可以改为字节对齐的写法?
|
||||
DataQueue<ResultItem>* m_dataQueue = nullptr ;
|
||||
// DataQueue<ResultItem>* m_dataQueue = nullptr ;
|
||||
std::shared_ptr<DataQueue<ResultItem>> m_sharedDataueue = nullptr;
|
||||
size_t m_searchId = 0;
|
||||
QMutex m_searchIdMutex;
|
||||
|
|
|
@ -24,23 +24,22 @@ size_t SearchControllerPrivate::refreshSearchId()
|
|||
|
||||
DataQueue<ResultItem> *SearchControllerPrivate::refreshDataqueue()
|
||||
{
|
||||
if(!m_dataQueue) {
|
||||
m_dataQueue = new DataQueue<ResultItem>;
|
||||
m_sharedDataueue = std::shared_ptr<DataQueue<ResultItem>>(m_dataQueue);
|
||||
return m_dataQueue;
|
||||
if(!m_sharedDataueue.get()) {
|
||||
// m_dataQueue = new DataQueue<ResultItem>;
|
||||
m_sharedDataueue = std::make_shared<DataQueue<ResultItem>>();
|
||||
return m_sharedDataueue.get();
|
||||
}
|
||||
m_dataQueue->clear();
|
||||
return m_dataQueue;;
|
||||
m_sharedDataueue.get()->clear();
|
||||
return m_sharedDataueue.get();
|
||||
}
|
||||
|
||||
DataQueue<ResultItem> *SearchControllerPrivate::initDataQueue()
|
||||
{
|
||||
if(!m_dataQueue) {
|
||||
m_dataQueue = new DataQueue<ResultItem>;
|
||||
m_sharedDataueue = std::shared_ptr<DataQueue<ResultItem>>(m_dataQueue);
|
||||
return m_dataQueue;
|
||||
if(!m_sharedDataueue.get()) {
|
||||
m_sharedDataueue = std::make_shared<DataQueue<ResultItem>>();
|
||||
return m_sharedDataueue.get();
|
||||
}
|
||||
return m_dataQueue;
|
||||
return m_sharedDataueue.get();
|
||||
}
|
||||
|
||||
void SearchControllerPrivate::addSearchDir(QString &path)
|
||||
|
|
Loading…
Reference in New Issue