[Webkit-unassigned] [Bug 27899] [Gtk] Expose a database API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 30 23:19:54 PDT 2009


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





--- Comment #11 from Xan Lopez <xan.lopez at gmail.com>  2009-08-30 23:19:53 PDT ---
(In reply to comment #10)
> > I don't see much point in using g_free/g_strdup here. Since it's const, just
> > use return protocol.utf8().data(), perhaps? Is there a problem you noticed with
> > doing that?
> 
> Hmm. Seems that utf8() returned a fresh CString every time. If so, the
> destructor for that object will be called after that line. Perhaps the text
> data is stored in some buffer outside the CString as well, but can we really
> depend on that happening? I used this particular pattern, because it was used
> for webkit_web_frame_get_name.

This is correct, the data returned by utf8() needs to be dupped before it's
returned to the user. If the return type is 'char*' it can be returned as is,
if it's 'const char*' the trick we use, like here, is to store it in some
private structure.

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