Commit b9bcae02 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Delay deletion of the AggregatedResultsStreams when there's no streams

We'll still need to be notified about its end
parent 611bd66b
......@@ -271,7 +271,7 @@ AggregatedResultsStream::AggregatedResultsStream(const QSet<ResultsStream*>& str
Q_ASSERT(!streams.contains(nullptr));
if (streams.isEmpty()) {
qWarning() << "no streams to aggregate!!";
destruction(nullptr);
QTimer::singleShot(0, this, &AggregatedResultsStream::clear);
}
for (auto stream: streams) {
......@@ -304,6 +304,11 @@ void AggregatedResultsStream::emitResults()
void AggregatedResultsStream::destruction(QObject* obj)
{
m_streams.remove(obj);
clear();
}
void AggregatedResultsStream::clear()
{
if (m_streams.isEmpty()) {
emitResults();
Q_EMIT finished();
......
......@@ -41,6 +41,7 @@ private:
void addResults(const QVector<AbstractResource*>& res);
void emitResults();
void destruction(QObject* obj);
void clear();
QSet<QObject*> m_streams;
QVector<AbstractResource*> m_results;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment