Bug 119765

Summary: Stop using DEFINE_STATIC_LOCAL with RetainPtr
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch jberlin: review+

Description Anders Carlsson 2013-08-13 13:40:51 PDT
Stop using DEFINE_STATIC_LOCAL with RetainPtr
Comment 1 Anders Carlsson 2013-08-13 13:43:05 PDT
Created attachment 208669 [details]
Patch
Comment 2 Anders Carlsson 2013-08-13 13:58:00 PDT
Committed r154021: <http://trac.webkit.org/changeset/154021>
Comment 3 Darin Adler 2013-08-13 13:59:10 PDT
Can we come up with a trick that makes it a compile error to make this error?
Comment 4 Anders Carlsson 2013-08-13 14:16:39 PDT
(In reply to comment #3)
> Can we come up with a trick that makes it a compile error to make this error?

I’m not sure. There are (currently) some places where we legitimately use DEFINE_STATIC_LOCAL with smart pointer types, for example:

static RetainPtr<NSEvent>& currentNSEventSlot()
{
    DEFINE_STATIC_LOCAL(RetainPtr<NSEvent>, event, ());
    return event;
}

I think we can just use NeverDestroyed for those cases though.
Comment 5 Darin Adler 2013-08-13 16:39:55 PDT
We can use NeverDestroyed everywhere instead of DEFINE_STATIC_LOCAL; maybe that’s what we should do first.