[netinstall] let queue finish properly

- if the queue is emptied, there was no usable data; set
  failure to NoData rather than BadData.
- FetchNextUnless::done() is done only if the parameter is true (that
  is, it's done!); otherwise should continue.
main
Adriaan de Groot 4 years ago
parent 67effe4214
commit bd2fb552b5

@ -26,8 +26,9 @@
* the queue continues loading. Calling release() before the
* destructor skips the fetchNext(), ending the queue-loading.
*
* Calling done(b) is the same as release(), **plus** done()
* is called on the queue if @p b is @c true.
* Calling done(b) is a conditional release: if @p b is @c true,
* queues a call to done() on the queue and releases it; otherwise,
* does nothing.
*/
class FetchNextUnless
{
@ -46,11 +47,14 @@ public:
void release() { m_q = nullptr; }
void done( bool b )
{
if ( b && m_q )
if ( b )
{
QMetaObject::invokeMethod( m_q, "done", Qt::QueuedConnection );
if ( m_q )
{
QMetaObject::invokeMethod( m_q, "done", Qt::QueuedConnection );
}
release();
}
release();
}
private:
@ -94,7 +98,7 @@ LoaderQueue::fetchNext()
{
if ( m_queue.isEmpty() )
{
m_config->setStatus( Config::Status::FailedBadData );
m_config->setStatus( Config::Status::FailedNoData );
emit done();
return;
}

Loading…
Cancel
Save