From 839fbd22a602aa4b9fa20e6c302329008c3aab09 Mon Sep 17 00:00:00 2001
From: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Date: Fri, 10 Jul 2009 14:44:53 +0200
Subject: Removed an assert from the QNetworkReply.

It is possible that finished() function will be called several times,
for example if the user calls QNetworkReply::close() as a result of
the authenticationRequired() signal, the connection will be closed
(which results in emitting a finished() signal), and then the
authentication will be cancelled, which will also try to emit the same
signal, however the connection state will already be set to Finished.

The fix is to just make sure if the finished() signal has already been
emitted by checking if the connection state is not Finished or
Aborted.

Reviewed-by: Thiago Macieira
---
 src/network/access/qnetworkreplyimpl.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index de39970..28319bb 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -461,8 +461,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data)
 void QNetworkReplyImplPrivate::finished()
 {
     Q_Q(QNetworkReplyImpl);
-    Q_ASSERT_X(state != Finished, "QNetworkReplyImpl",
-               "Backend called finished/finishedWithError more than once");
+    if (state == Finished || state == Aborted)
+        return;
 
     state = Finished;
     pendingNotifications.clear();
-- 
cgit v0.12