[Webkit-unassigned] [Bug 20483] New: WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 22 02:15:59 PDT 2008


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

           Summary: WebKit GTK Port needs a smartpointer to handle g_free
                    (GFreePtr?)
           Product: WebKit
           Version: 526+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: eric at webkit.org


WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)

I may cry the next time I see a patch with g_free in it. :(  It's just an
accident waiting to happen.

Can we please have a smart pointer which knows how to call g_free from its
destructor?

The only thing special about a GFreePtr (besides being a direct copy/paste from
OwnPtr) is that it will need an accessor to get at the underlying raw pointer.

Something like:

PtrType& rawPtr();

That would make it possible to use GFreePtr with calls like this:

GFreePtr contents;
some_gtk_method_which_returns_via_arguments(contents.rawPtr());

Then "contents" (if it got set as part of the function call) would
automagically have g_free called on it when it went out of scope!  No more
leaks due to early returns!


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



More information about the webkit-unassigned mailing list