@@ -1663,7 +1663,18 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl& url, QgsWcsAuthorizati
1663
1663
, mCachedData( cachedData )
1664
1664
, mWcsVersion( wcsVersion )
1665
1665
, mCachedError( cachedError )
1666
+ , mFeedback( feedback )
1666
1667
{
1668
+ if ( feedback )
1669
+ {
1670
+ connect ( feedback, SIGNAL ( cancelled () ), this , SLOT ( cancelled () ), Qt::QueuedConnection );
1671
+
1672
+ // rendering could have been cancelled before we started to listen to cancelled() signal
1673
+ // so let's check before doing the download and maybe quit prematurely
1674
+ if ( feedback->isCancelled () )
1675
+ return ;
1676
+ }
1677
+
1667
1678
QNetworkRequest request ( url );
1668
1679
if ( !mAuth .setAuthorization ( request ) )
1669
1680
{
@@ -1677,9 +1688,6 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl& url, QgsWcsAuthorizati
1677
1688
mCacheReply = QgsNetworkAccessManager::instance ()->get ( request );
1678
1689
connect ( mCacheReply , SIGNAL ( finished () ), this , SLOT ( cacheReplyFinished () ) );
1679
1690
connect ( mCacheReply , SIGNAL ( downloadProgress ( qint64, qint64 ) ), this , SLOT ( cacheReplyProgress ( qint64, qint64 ) ) );
1680
-
1681
- if ( feedback )
1682
- connect ( feedback, SIGNAL ( cancelled () ), this , SLOT ( cancelled () ), Qt::QueuedConnection );
1683
1691
}
1684
1692
1685
1693
QgsWcsDownloadHandler::~QgsWcsDownloadHandler ()
@@ -1689,6 +1697,9 @@ QgsWcsDownloadHandler::~QgsWcsDownloadHandler()
1689
1697
1690
1698
void QgsWcsDownloadHandler::blockingDownload ()
1691
1699
{
1700
+ if ( mFeedback && mFeedback ->isCancelled () )
1701
+ return ; // nothing to do
1702
+
1692
1703
mEventLoop ->exec ( QEventLoop::ExcludeUserInputEvents );
1693
1704
1694
1705
Q_ASSERT ( !mCacheReply );
0 commit comments