Skip to content
Permalink
Browse files

Avoid deadlock by using Qt::DirectConnection

  • Loading branch information
m-kuhn committed May 23, 2018
1 parent c59df79 commit 143ee82ec9747edab93750eea03698da9bac76b7
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/providers/wfs/qgswfsrequest.cpp
@@ -132,6 +132,9 @@ bool QgsWfsRequest::sendGET( const QUrl &url, bool synchronous, bool forceRefres
{
bool success = true;
mReply = QgsNetworkAccessManager::instance()->get( request );

Q_ASSERT( QThread::currentThread() == mReply->thread() );

mReply->setReadBufferSize( READ_BUFFER_SIZE_HINT );
if ( !mUri.auth().setAuthorizationReply( mReply ) )
{
@@ -142,13 +145,13 @@ bool QgsWfsRequest::sendGET( const QUrl &url, bool synchronous, bool forceRefres
}
else
{
connect( mReply, &QNetworkReply::finished, this, &QgsWfsRequest::replyFinished );
connect( mReply, &QNetworkReply::downloadProgress, this, &QgsWfsRequest::replyProgress );
connect( mReply, &QNetworkReply::finished, this, &QgsWfsRequest::replyFinished, Qt::DirectConnection );
connect( mReply, &QNetworkReply::downloadProgress, this, &QgsWfsRequest::replyProgress, Qt::DirectConnection );

if ( synchronous )
{
QEventLoop loop;
connect( this, &QgsWfsRequest::downloadFinished, &loop, &QEventLoop::quit );
connect( this, &QgsWfsRequest::downloadFinished, &loop, &QEventLoop::quit, Qt::DirectConnection );
loop.exec();
}
}

0 comments on commit 143ee82

Please sign in to comment.
You can’t perform that action at this time.