[Webkit-unassigned] [Bug 74108] [Qt] Incorrect deletion of m_replyWrapper in QtNetworkReplyHandler::finish

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 8 15:35:30 PST 2011


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





--- Comment #4 from Dawit A. <adawit at kde.org>  2011-12-08 15:35:30 PST ---
(In reply to comment #3)
> (From update of attachment 118437 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=118437&action=review
> 
> > Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp:442
> > -        m_replyWrapper = nullptr;
> > +        m_replyWrapper->deleteLater();
> 
> Isn't this going to cause more crashes? The QObject will be deleted later, but the OwnPtr doesn't know that and in its destructor it will try to call the m_replyWrapper's destructor again, resulting in double deletion.

That is indeed a problem. My mind was simply substituted the behavior of one of the Qt Pointer handling classes for OwnPtr. Anyhow, it is still easy enough resolve this issue. See below.

> Perhaps a better fix would be something along the lines of m_replyWrapper.leakPtr()->deleteLater(); - as ugly as it is...

QNetworkReplyWrapper already comes with its own release() function ; so I can change the code to call release() first and do a deleteLater() on the QNetworkReply pointer it returns. That way everything is cleaned up proper.

> Or simply not use an OwnPtr at all.

That is another alternative, but I think the above method would suffice.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list