Fix for memory leak in ResultStore
In ResultStoreBase::addResults() it possible that the ResultItem we create is invalid (filter-mode enabled). Since an invalid ResultItem won't have any result data, we need to make sure that we don't allocate any data for it. Task-number: QTBUG-27224 Change-Id: Ic99b191db0e9dd4e29b64911f87d90a8148bb7a5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
8003fd6d5b
commit
6039179373
@ -176,7 +176,10 @@ public:
|
|||||||
|
|
||||||
int addResults(int index, const QVector<T> *results, int totalCount)
|
int addResults(int index, const QVector<T> *results, int totalCount)
|
||||||
{
|
{
|
||||||
return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount);
|
if (m_filterMode == true && results->count() != totalCount && 0 == results->count())
|
||||||
|
return ResultStoreBase::addResults(index, 0, 0, totalCount);
|
||||||
|
else
|
||||||
|
return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int addCanceledResult(int index)
|
int addCanceledResult(int index)
|
||||||
|
Loading…
Reference in New Issue
Block a user