Reviewed by Beth.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2005 23:50:36 +0000 (23:50 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2005 23:50:36 +0000 (23:50 +0000)
        Another fix for 4098083 to apply to sliders.

        <rdar://problem/4098083> REGRESSION (125-312): crash
        in [KWQTableView resignFirstResponder] selecting from JS menu
        (car4you.at, etc.)

        Since it is possible that a render widget's eventFilterObject
        has been destroyed even though the render widget is still ref-ed,
        we need to nil-check the eventFilterObject before we use it to get
        the eventFilter.

        * kwq/KWQSlider.mm:
        (-[KWQSlider becomeFirstResponder]): Added nil check.
        (-[KWQSlider resignFirstResponder]): Added nil check.

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

WebCore/ChangeLog-2005-12-19
WebCore/kwq/KWQSlider.mm

index 50033b8e08c6d478ff4fafa8be33f6019344529e..c4afb17281bd1386395e4d9eab0e2ab913afc505 100644 (file)
@@ -1,3 +1,22 @@
+2005-12-01  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Beth.
+        
+        Another fix for 4098083 to apply to sliders.
+
+        <rdar://problem/4098083> REGRESSION (125-312): crash 
+        in [KWQTableView resignFirstResponder] selecting from JS menu 
+        (car4you.at, etc.)
+
+        Since it is possible that a render widget's eventFilterObject
+        has been destroyed even though the render widget is still ref-ed,
+        we need to nil-check the eventFilterObject before we use it to get
+        the eventFilter.
+
+        * kwq/KWQSlider.mm:
+        (-[KWQSlider becomeFirstResponder]): Added nil check.
+        (-[KWQSlider resignFirstResponder]): Added nil check.
+
 2005-12-01  Adele Peterson  <adele@apple.com>
 
         Reviewed by Vicki and Dave Harrsion.
index 3f1b3034aa0487a4827095d76f49d2f533922939..51ec04294a7f4d589ca27b3caf96e79e8d394361 100644 (file)
@@ -111,7 +111,8 @@ using khtml::RenderLayer;
 
         if (slider) {
             QFocusEvent event(QEvent::FocusIn);
-            const_cast<QObject *>(slider->eventFilterObject())->eventFilter(slider, &event);
+            if (slider->eventFilterObject())
+                const_cast<QObject *>(slider->eventFilterObject())->eventFilter(slider, &event);
         }
     }
     return become;
@@ -122,8 +123,10 @@ using khtml::RenderLayer;
     BOOL resign = [super resignFirstResponder];
     if (resign && slider) {
         QFocusEvent event(QEvent::FocusOut);
-        const_cast<QObject *>(slider->eventFilterObject())->eventFilter(slider, &event);
-        [KWQKHTMLPart::bridgeForWidget(slider) formControlIsResigningFirstResponder:self];
+        if (slider->eventFilterObject()) {
+            const_cast<QObject *>(slider->eventFilterObject())->eventFilter(slider, &event);
+            [KWQKHTMLPart::bridgeForWidget(slider) formControlIsResigningFirstResponder:self];
+        }
     }
     return resign;
 }