Reviewed by John.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2005 00:15:52 +0000 (00:15 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2005 00:15:52 +0000 (00:15 +0000)
        Could not figure out how to make an <object> fallback, so for now, no layout test.

        - fixed <rdar://problem/4134124> REGRESSION (tip of tree): crash in QWidget::getView handling onunload event (yahoo.com)

        * khtml/html/html_objectimpl.cpp: (DOM::HTMLObjectElementImpl::getObjectInstance):
        Check type of RenderObject to be sure it is a RenderWidget before calling widget() on it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/html/html_objectimpl.cpp

index dd5377a6ab1bf5983b1258c94ce1749c48136bcc..7be044812f517a63094dd10ec047664d15821925 100644 (file)
@@ -1,3 +1,13 @@
+2005-05-30  Darin Adler  <darin@apple.com>
+
+        Reviewed by John.
+        Could not figure out how to make an <object> fallback, so for now, no layout test.
+
+        - fixed <rdar://problem/4134124> REGRESSION (tip of tree): crash in QWidget::getView handling onunload event (yahoo.com)
+
+        * khtml/html/html_objectimpl.cpp: (DOM::HTMLObjectElementImpl::getObjectInstance):
+        Check type of RenderObject to be sure it is a RenderWidget before calling widget() on it.
+
 2005-05-27  Adele Peterson  <adele@apple.com>
 
         Change by Darin, reviewed by me.
index 343fce4dc89cff6eecf0e5496a1bba8069f02897..ea4c705a0b6b5f21c7c58c1bbc13217079cbdc34 100644 (file)
@@ -521,19 +521,22 @@ KJS::Bindings::Instance *HTMLObjectElementImpl::getObjectInstance() const
 
     if (objectInstance)
         return objectInstance;
-    
-    RenderPartObject *r = static_cast<RenderPartObject*>(m_render);
-    if (r) {
-        if (r->widget()){
-            // Call into the part (and over the bridge) to pull the Bindings::Instance
-            // from the guts of the plugin.
-            void *_view = r->widget()->getView();
-            objectInstance = KWQ(part)->getObjectInstanceForView((NSView *)_view);
-            // Applet may specified with <object> tag.
-            if (!objectInstance)
-                objectInstance = KWQ(part)->getAppletInstanceForView((NSView *)_view);
+
+    if (RenderObject *r = m_render) {
+        if (r->isWidget()) {
+            if (QWidget *widget = static_cast<RenderWidget *>(r)->widget()) {
+                if (NSView *view = widget->getView())  {
+                    // Call into the part (and over the bridge) to pull the Bindings::Instance
+                    // from the guts of the plugin.
+                    objectInstance = KWQ(part)->getObjectInstanceForView(view);
+                    // Applet may specified with <object> tag.
+                    if (!objectInstance)
+                        objectInstance = KWQ(part)->getAppletInstanceForView(view);
+                }
+            }
         }
     }
+
     return objectInstance;
 }
 #endif