WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
42447
DeviceOrientationEvent.h should not forward-declare DeviceOrientation
https://bugs.webkit.org/show_bug.cgi?id=42447
Summary
DeviceOrientationEvent.h should not forward-declare DeviceOrientation
Hans Wennborg
Reported
2010-07-16 04:51:10 PDT
Because DeviceOrientationEvent has a member m_orientation of type RefPtr<DeviceOrientation>, the generated ~DeviceOrientationEvent() will destruct the RefPtr and eventually end up doing ptr->deref() in PassRefPtr.h:58, with ptr as an incomplete type. Clang gives an error about this when building Chrome: In file included from third_party/WebKit/WebCore/dom/Document.cpp:27: In file included from third_party/WebKit/WebCore/dom/Document.h:29: In file included from third_party/WebKit/WebCore/loader/CachedResourceHandle.h:29: In file included from third_party/WebKit/WebCore/loader/CachedResource.h:28: In file included from third_party/WebKit/WebCore/platform/text/PlatformString.h:28: In file included from third_party/WebKit/JavaScriptCore/wtf/text/WTFString.h:28: In file included from third_party/WebKit/JavaScriptCore/wtf/text/StringImpl.h:28: In file included from third_party/WebKit/JavaScriptCore/wtf/CrossThreadRefCounted.h:35: third_party/WebKit/JavaScriptCore/wtf/PassRefPtr.h:58:16: error: member access into incomplete type 'WebCore::DeviceOrientation' ptr->deref(); ^ In file included from third_party/WebKit/WebCore/dom/Document.cpp:27: In file included from third_party/WebKit/WebCore/dom/Document.h:29: In file included from third_party/WebKit/WebCore/loader/CachedResourceHandle.h:29: In file included from third_party/WebKit/WebCore/loader/CachedResource.h:28: In file included from third_party/WebKit/WebCore/platform/text/PlatformString.h:28: In file included from third_party/WebKit/JavaScriptCore/wtf/text/WTFString.h:28: In file included from third_party/WebKit/JavaScriptCore/wtf/text/StringImpl.h:32: In file included from third_party/WebKit/JavaScriptCore/wtf/Vector.h:28: In file included from third_party/WebKit/JavaScriptCore/wtf/VectorTraits.h:25: third_party/WebKit/JavaScriptCore/wtf/RefPtr.h:56:35: note: in instantiation of function template specialization 'WTF::derefIfNotNull<WebCore::DeviceOrientation>' requested here ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); } ^ In file included from third_party/WebKit/WebCore/dom/Document.cpp:47: third_party/WebKit/WebCore/dom/DeviceOrientationEvent.h:35:7: note: in instantiation of member function 'WTF::RefPtr<WebCore::DeviceOrientation>::~RefPtr' requested here class DeviceOrientationEvent : public Event { ^ third_party/WebKit/WebCore/dom/DeviceOrientationEvent.h:33:7: note: forward declaration of 'WebCore::DeviceOrientation' class DeviceOrientation;
Attachments
Patch
(1.21 KB, patch)
2010-07-16 04:59 PDT
,
Hans Wennborg
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Hans Wennborg
Comment 1
2010-07-16 04:59:11 PDT
Created
attachment 61795
[details]
Patch
Steve Block
Comment 2
2010-07-16 05:11:16 PDT
Comment on
attachment 61795
[details]
Patch r=me
WebKit Commit Bot
Comment 3
2010-07-16 06:50:47 PDT
Comment on
attachment 61795
[details]
Patch Clearing flags on attachment: 61795 Committed
r63544
: <
http://trac.webkit.org/changeset/63544
>
WebKit Commit Bot
Comment 4
2010-07-16 06:50:52 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 5
2010-07-16 09:36:55 PDT
Adding the include is one solution in a case like this. Another is to explicitly declare the virtual destructor and define it in the .cpp file. It will have just an empty body, but it will make sure that people who include the header don’t have to compile the destructor.
Hans Wennborg
Comment 6
2010-07-16 09:47:48 PDT
(In reply to
comment #5
)
> Adding the include is one solution in a case like this. Another is to explicitly declare the virtual destructor and define it in the .cpp file. It will have just an empty body, but it will make sure that people who include the header don’t have to compile the destructor.
Ah, I didn't think of that. Do you think we should change it?
Hans Wennborg
Comment 7
2010-07-16 10:19:42 PDT
Uploaded patch to
Bug 42466
that implements Darin's suggestion, as it reduces the header size.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug