<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>42447</bug_id>
          
          <creation_ts>2010-07-16 04:51:10 -0700</creation_ts>
          <short_desc>DeviceOrientationEvent.h should not forward-declare DeviceOrientation</short_desc>
          <delta_ts>2010-07-16 10:19:42 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Hans Wennborg">hans</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>steveblock</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>252459</commentid>
    <comment_count>0</comment_count>
    <who name="Hans Wennborg">hans</who>
    <bug_when>2010-07-16 04:51:10 -0700</bug_when>
    <thetext>Because DeviceOrientationEvent has a member m_orientation of type RefPtr&lt;DeviceOrientation&gt;, the generated ~DeviceOrientationEvent() will destruct the RefPtr and eventually end up doing ptr-&gt;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
      &apos;WebCore::DeviceOrientation&apos;
            ptr-&gt;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
      &apos;WTF::derefIfNotNull&lt;WebCore::DeviceOrientation&gt;&apos; 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
      &apos;WTF::RefPtr&lt;WebCore::DeviceOrientation&gt;::~RefPtr&apos; requested here
class DeviceOrientationEvent : public Event {
      ^
third_party/WebKit/WebCore/dom/DeviceOrientationEvent.h:33:7: note: forward declaration of
      &apos;WebCore::DeviceOrientation&apos;
class DeviceOrientation;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252460</commentid>
    <comment_count>1</comment_count>
      <attachid>61795</attachid>
    <who name="Hans Wennborg">hans</who>
    <bug_when>2010-07-16 04:59:11 -0700</bug_when>
    <thetext>Created attachment 61795
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252464</commentid>
    <comment_count>2</comment_count>
      <attachid>61795</attachid>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-07-16 05:11:16 -0700</bug_when>
    <thetext>Comment on attachment 61795
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252490</commentid>
    <comment_count>3</comment_count>
      <attachid>61795</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-07-16 06:50:47 -0700</bug_when>
    <thetext>Comment on attachment 61795
Patch

Clearing flags on attachment: 61795

Committed r63544: &lt;http://trac.webkit.org/changeset/63544&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252491</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-07-16 06:50:52 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252560</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-07-16 09:36:55 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252566</commentid>
    <comment_count>6</comment_count>
    <who name="Hans Wennborg">hans</who>
    <bug_when>2010-07-16 09:47:48 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; 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&apos;t think of that. Do you think we should change it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>252580</commentid>
    <comment_count>7</comment_count>
    <who name="Hans Wennborg">hans</who>
    <bug_when>2010-07-16 10:19:42 -0700</bug_when>
    <thetext>Uploaded patch to Bug 42466 that implements Darin&apos;s suggestion, as it reduces the header size.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>61795</attachid>
            <date>2010-07-16 04:59:11 -0700</date>
            <delta_ts>2010-07-16 06:50:47 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-42447-20100716125909.patch</filename>
            <type>text/plain</type>
            <size>1241</size>
            <attacher name="Hans Wennborg">hans</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
YjgzYzcwZDE5MjVjOWVmOWU1NjZlY2FlOGU3YzM5MWNlZDFiZDE2ZS4uZmQxNmQ1YzdiODBiNzM2
ZmViODU1YzI1YzNjZTgwMTU0ZDA0YzE5MCAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cK
KysrIGIvV2ViQ29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNCBAQAorMjAxMC0wNy0xNiAgSGFu
cyBXZW5uYm9yZyAgPGhhbnNAY2hyb21pdW0ub3JnPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5P
Qk9EWSAoT09QUyEpLgorCisgICAgICAgIERldmljZU9yaWVudGF0aW9uRXZlbnQuaCBzaG91bGQg
bm90IGZvcndhcmQtZGVjbGFyZSBEZXZpY2VPcmllbnRhdGlvbgorICAgICAgICBodHRwczovL2J1
Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9NDI0NDcKKworICAgICAgICBXaGVuIGRlc3Ry
dWN0aW5nIG1fb3JpZW50YXRpb24sIERldmljZU9yaWVudGF0aW9uIGNhbm5vdCBiZSBhbiBpbmNv
bXBsZXRlIHR5cGUuCisKKyAgICAgICAgKiBkb20vRGV2aW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