Skip to content

Commit 143ee82

Browse files
committedJun 14, 2018
Avoid deadlock by using Qt::DirectConnection
1 parent c59df79 commit 143ee82

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/providers/wfs/qgswfsrequest.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ bool QgsWfsRequest::sendGET( const QUrl &url, bool synchronous, bool forceRefres
132132
{
133133
bool success = true;
134134
mReply = QgsNetworkAccessManager::instance()->get( request );
135+
136+
Q_ASSERT( QThread::currentThread() == mReply->thread() );
137+
135138
mReply->setReadBufferSize( READ_BUFFER_SIZE_HINT );
136139
if ( !mUri.auth().setAuthorizationReply( mReply ) )
137140
{
@@ -142,13 +145,13 @@ bool QgsWfsRequest::sendGET( const QUrl &url, bool synchronous, bool forceRefres
142145
}
143146
else
144147
{
145-
connect( mReply, &QNetworkReply::finished, this, &QgsWfsRequest::replyFinished );
146-
connect( mReply, &QNetworkReply::downloadProgress, this, &QgsWfsRequest::replyProgress );
148+
connect( mReply, &QNetworkReply::finished, this, &QgsWfsRequest::replyFinished, Qt::DirectConnection );
149+
connect( mReply, &QNetworkReply::downloadProgress, this, &QgsWfsRequest::replyProgress, Qt::DirectConnection );
147150

148151
if ( synchronous )
149152
{
150153
QEventLoop loop;
151-
connect( this, &QgsWfsRequest::downloadFinished, &loop, &QEventLoop::quit );
154+
connect( this, &QgsWfsRequest::downloadFinished, &loop, &QEventLoop::quit, Qt::DirectConnection );
152155
loop.exec();
153156
}
154157
}

0 commit comments

Comments
 (0)
Please sign in to comment.