[Webkit-unassigned] [Bug 82082] [SOUP] Implement missing methods in CookieJarSoup

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 26 09:47:42 PDT 2012


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





--- Comment #10 from Carlos Garcia Campos <cgarcia at igalia.com>  2012-03-26 09:47:42 PST ---
(In reply to comment #9)
> (In reply to comment #8)
> 
> > I don't get what you mean, GOwnPtr always frees the pointer as a side-effect for me. We usually do something like
> > 
> > GOwnPtr<char> foo(g_strdup("Foo"));
> > use_foo (bar, foo.get());
> > 
> > and that's supposed to be fine. 
> > 
> > This is the same, we have a method that returns a new allocated list, which transfers the full list, container and contents, so you are expected to free it, the same way g_strdup() returns a new allocated string that you should free it when done. 
> 
> Note the "Own" in GOwnPtr. The way it's typically designed to work is that OwnPtr immediately contains a raw pointer after allocation. It owns it. The WTF version even has PassOwnPtr, which tries to enforce this more strongly. 

transfer container means you owns the container, transfer full means you own both the container and the items contained. 

> In this case GOwnPtr doesn't "own" the pointers in the GSList. Conceptually speaking, they are owned by the GSList itself. soup_cookies_free frees both the list and the individual cookies, because in a sense they are one complete unit of data. In your patch GOwnPtr is simply used as a mechanism to free the cookies that are owned by the list.

soup_cookies_free is just a convenient function to free both the list and the items with a single call.

> This is why it was confusing to me.

-- 
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