Skip to content
Permalink
Browse files

Merge pull request #632 from BioEcoForests/master

Always delete WFS network replies, fixes #7588
  • Loading branch information
mhugent committed Jun 4, 2013
2 parents f9a0a1d + b7c07de commit 91eaa415c9e0ef314aa24ece5e66788569c48c0b
Showing with 9 additions and 7 deletions.
  1. +9 −7 src/providers/wfs/qgswfscapabilities.cpp
@@ -148,32 +148,36 @@ void QgsWFSCapabilities::requestCapabilities()

void QgsWFSCapabilities::capabilitiesReplyFinished()
{
QNetworkReply* reply = mCapabilitiesReply;

reply->deleteLater();
mCapabilitiesReply = 0;

// handle network errors
if ( mCapabilitiesReply->error() != QNetworkReply::NoError )
if ( reply->error() != QNetworkReply::NoError )
{
mErrorCode = QgsWFSCapabilities::NetworkError;
mErrorMessage = mCapabilitiesReply->errorString();
mErrorMessage = reply->errorString();
emit gotCapabilities();
return;
}

// handle HTTP redirects
QVariant redirect = mCapabilitiesReply->attribute( QNetworkRequest::RedirectionTargetAttribute );
QVariant redirect = reply->attribute( QNetworkRequest::RedirectionTargetAttribute );
if ( !redirect.isNull() )
{
QgsDebugMsg( "redirecting to " + redirect.toUrl().toString() );
QNetworkRequest request( redirect.toUrl() );
request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork );
request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true );

mCapabilitiesReply->deleteLater();
mCapabilitiesReply = QgsNetworkAccessManager::instance()->get( request );

connect( mCapabilitiesReply, SIGNAL( finished() ), this, SLOT( capabilitiesReplyFinished() ) );
return;
}

QByteArray buffer = mCapabilitiesReply->readAll();
QByteArray buffer = reply->readAll();

QgsDebugMsg( "parsing capabilities: " + buffer );

@@ -264,8 +268,6 @@ void QgsWFSCapabilities::capabilitiesReplyFinished()
mCaps.featureTypes.append( featureType );
}

mCapabilitiesReply->deleteLater();
mCapabilitiesReply = 0;
emit gotCapabilities();
}

0 comments on commit 91eaa41

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