RESOLVED FIXED24263
[GTK] ref ResourceHandle until we are finished with it
https://bugs.webkit.org/show_bug.cgi?id=24263
Summary [GTK] ref ResourceHandle until we are finished with it
Xan Lopez
Reported 2009-02-28 11:21:17 PST
Add a ref to the ResourceHandle in startHttp so we can keep it alive untill all callbacks have been executed, and unref it when soup tells us it's done with the SoupMessage (in finishedCallback). Fixes a number of crashes when calling didReceiveData whould crash because of the handle dying. Ideally we'd like to do this automatically with RefPtr I guess, but I'm not sure how to apply that here.
Attachments
refsouphandle.patch (3.73 KB, patch)
2009-02-28 11:23 PST, Xan Lopez
no flags
refsouphandlev2.patch (3.74 KB, patch)
2009-02-28 11:27 PST, Xan Lopez
no flags
Xan Lopez
Comment 1 2009-02-28 11:23:18 PST
Created attachment 28121 [details] refsouphandle.patch Patch. And thanks to kov for the joint debugging session! :)
Xan Lopez
Comment 2 2009-02-28 11:27:55 PST
Created attachment 28122 [details] refsouphandlev2.patch Slightly improve comment text.
Holger Freyther
Comment 3 2009-02-28 11:55:35 PST
Comment on attachment 28122 [details] refsouphandlev2.patch r=me with two strings attached: - If possible I would like to see the adopRef in the finishedCallback (after this patch). - we need to find out if finishedCallback will always be called or if we just created a memory leak. the consensus on #webkit-gtk was that it is better to leak than to crash (for this release). We need to clean this up after the release... > @@ -262,30 +262,32 @@ static void finishedCallback(SoupSession *session, SoupMessage* msg, gpointer da > > ResourceHandleClient* client = handle->client(); > if (!client) > - return; > + goto exit; this goto might be avoided with a RefPtr::adoptRef early on. I'm not quite sure, it would be nice if you could investiage that. > > d->m_msg = static_cast<SoupMessage*>(g_object_ref(msg)); > + ref(); // balanced by a deref() in finishedCallback, which should always run maybe you could move the comment above the line? > soup_session_queue_message(session, d->m_msg, finishedCallback, ma
Christian Dywan
Comment 4 2009-02-28 12:31:44 PST
2009-02-28 Xan Lopez <xan@gnome.org> Reviewed by Holger Freyther. https://bugs.webkit.org/show_bug.cgi?id=24263 [GTK] ref ResourceHandle until we are finished with it Add a ref to the ResourceHandle in startHttp so we can keep it alive untill all callbacks have been executed, and unref it when soup tells us it's done with the SoupMessage (in finishedCallback). Fixes a number of crashes when calling didReceiveData whould crash because of the handle dying. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::finishedCallback): (WebCore::ResourceHandle::startHttp): Adjusted the comment and used adoptRef as suggested and discussed on IRC.
Xan Lopez
Comment 5 2009-02-28 15:03:47 PST
*** Bug 24196 has been marked as a duplicate of this bug. ***
Xan Lopez
Comment 6 2009-03-07 12:40:52 PST
Well, since all the points Holger raised were addressed (some by mistake in the same patch :)), I think we can close this.
Note You need to log in before you can comment on or make changes to this bug.