Merge branch '1213-ukss' into 'ukss-dev'

修复队列未释放的问题.

See merge request kylin-desktop/ukui-search!257
This commit is contained in:
纪笑旭 2022-02-17 01:54:14 +00:00
commit 9dd61b983e
2 changed files with 11 additions and 12 deletions

View File

@ -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;

View File

@ -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)