Bug 119765 - Stop using DEFINE_STATIC_LOCAL with RetainPtr
Summary: Stop using DEFINE_STATIC_LOCAL with RetainPtr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-13 13:40 PDT by Anders Carlsson
Modified: 2013-08-13 16:39 PDT (History)
1 user (show)

See Also:


Attachments
Patch (6.38 KB, patch)
2013-08-13 13:43 PDT, Anders Carlsson
jberlin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.