Commit 64ec5c94 authored by jocelyn.turcotte@nokia.com's avatar jocelyn.turcotte@nokia.com
Browse files

[Qt] Refactor QNetworkReplyHandler::finish() to prevent crashes.

https://bugs.webkit.org/show_bug.cgi?id=50761

Reviewed by Kenneth Rohde Christiansen.

This patch change the order to check if m_reply is null instead,
explicitly deleting the reply before calling start() for a redirect,
or after calling didFinishLoading()/didFail() in other cases.

* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyHandler::finish):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b216401b
2010-12-09 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Refactor QNetworkReplyHandler::finish() to prevent crashes.
https://bugs.webkit.org/show_bug.cgi?id=50761
This patch change the order to check if m_reply is null instead,
explicitly deleting the reply before calling start() for a redirect,
or after calling didFinishLoading()/didFail() in other cases.
* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyHandler::finish):
2010-12-09 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -300,12 +300,8 @@ void QNetworkReplyHandler::finish()
return;
}
QNetworkReply* oldReply = m_reply;
if (m_redirected) {
resetState();
start();
} else if (!m_reply->error() || ignoreHttpError(m_reply, m_responseContainsData)) {
if (!m_redirected) {
if (!m_reply->error() || ignoreHttpError(m_reply, m_responseContainsData)) {
client->didFinishLoading(m_resourceHandle, 0);
} else {
QUrl url = m_reply->url();
......@@ -319,10 +315,18 @@ void QNetworkReplyHandler::finish()
client->didFail(m_resourceHandle, error);
}
}
oldReply->deleteLater();
if (oldReply == m_reply)
if (m_reply) {
m_reply->deleteLater();
m_reply = 0;
}
} else {
if (m_reply) {
m_reply->deleteLater();
m_reply = 0;
}
resetState();
start();
}
}
void QNetworkReplyHandler::sendResponseIfNeeded()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment