Allocate JsNetworkRequest on the stack to avoid leaking it.

https://code.google.com/p/phantomjs/issues/detail?id=539
1.9
Vitaliy Slobodin 2013-02-23 23:25:38 +04:00 committed by Ariya Hidayat
parent 212e4b7cd9
commit fed209c546
1 changed files with 3 additions and 3 deletions

View File

@ -214,14 +214,14 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR
data["headers"] = headers;
data["time"] = QDateTime::currentDateTime();
JsNetworkRequest* jsNetworkRequest = new JsNetworkRequest(&req, this);
emit resourceRequested(data, jsNetworkRequest);
JsNetworkRequest jsNetworkRequest(&req, this);
emit resourceRequested(data, &jsNetworkRequest);
// Pass duty to the superclass - Nothing special to do here (yet?)
QNetworkReply *reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
// reparent jsNetworkRequest to make sure that it will be destroyed with QNetworkReply
jsNetworkRequest->setParent(reply);
jsNetworkRequest.setParent(reply);
m_ids[reply] = m_idCounter;