Reviewed by Mark Rowe.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2007 20:24:10 +0000 (20:24 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2007 20:24:10 +0000 (20:24 +0000)
        - fix <rdar://problem/5183775> Uninitialized memory in -[WebDynamicScrollBarsView updateScrollers]

        * WebView/WebDynamicScrollBarsView.m: (-[WebDynamicScrollBarsView updateScrollers]):
        Change code path so it doesn't dispatch a method that returns an NSSize passing a nil object.
        It's safe to do that for functions that return integers or pointers, but not structures.

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

WebKit/ChangeLog
WebKit/WebView/WebDynamicScrollBarsView.m

index eed9444cd0eb73a5e1e8ee297bb9807c4377796b..0f18175e52d7df380c810671c1a22cdf29980da2 100644 (file)
@@ -1,8 +1,19 @@
+2007-10-17  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        - fix <rdar://problem/5183775> Uninitialized memory in -[WebDynamicScrollBarsView updateScrollers]
+
+        * WebView/WebDynamicScrollBarsView.m: (-[WebDynamicScrollBarsView updateScrollers]):
+        Change code path so it doesn't dispatch a method that returns an NSSize passing a nil object.
+        It's safe to do that for functions that return integers or pointers, but not structures.
+
 2007-10-16  David Kilzer  <ddkilzer@apple.com>
 
         Reviewed by Timothy.
 
-        <rdar://problem/5544354> Wrong delegate method called in WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
+        <rdar://problem/5544354> Wrong delegate method called in
+        WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
 
         * WebCoreSupport/WebFrameLoaderClient.mm:
         (WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): Fixed selector name.
index 0f04dbe75ce54c163fd9f5d342d6b57bbceea9e3..8374725c4d74272cc31723ea75db9e47b176946f 100644 (file)
             // Do a layout if pending, before checking if scrollbars are needed.
             // This fixes 2969367, although may introduce a slowdown in live resize performance.
             NSView *documentView = [self documentView];
-            if ((hasVerticalScroller != oldHasVertical ||
-                hasHorizontalScroller != oldHasHorizontal || [documentView inLiveResize]) && [documentView conformsToProtocol:@protocol(WebDocumentView)]) {
-                [(id <WebDocumentView>)documentView setNeedsLayout: YES];
-                [(id <WebDocumentView>)documentView layout];
-            }
-
-            NSSize documentSize = [documentView frame].size;
-            NSSize frameSize = [self frame].size;
-
-            scrollsVertically = (vScroll == WebCoreScrollbarAlwaysOn) ||
-                (vScroll == WebCoreScrollbarAuto && documentSize.height > frameSize.height);
-            if (scrollsVertically)
-                scrollsHorizontally = (hScroll == WebCoreScrollbarAlwaysOn) ||
-                    (hScroll == WebCoreScrollbarAuto && documentSize.width + [NSScroller scrollerWidth] > frameSize.width);
-            else {
-                scrollsHorizontally = (hScroll == WebCoreScrollbarAlwaysOn) ||
-                    (hScroll == WebCoreScrollbarAuto && documentSize.width > frameSize.width);
-                if (scrollsHorizontally)
-                    scrollsVertically = (vScroll == WebCoreScrollbarAlwaysOn) ||
-                        (vScroll == WebCoreScrollbarAuto && documentSize.height + [NSScroller scrollerWidth] > frameSize.height);
+            if (!documentView) {
+                scrollsHorizontally = NO;
+                scrollsVertically = NO;
+            } else {
+                if ((hasVerticalScroller != oldHasVertical ||
+                    hasHorizontalScroller != oldHasHorizontal || [documentView inLiveResize]) && [documentView conformsToProtocol:@protocol(WebDocumentView)]) {
+                    [(id <WebDocumentView>)documentView setNeedsLayout: YES];
+                    [(id <WebDocumentView>)documentView layout];
+                }
+
+                NSSize documentSize = [documentView frame].size;
+                NSSize frameSize = [self frame].size;
+
+                scrollsVertically = (vScroll == WebCoreScrollbarAlwaysOn) ||
+                    (vScroll == WebCoreScrollbarAuto && documentSize.height > frameSize.height);
+                if (scrollsVertically)
+                    scrollsHorizontally = (hScroll == WebCoreScrollbarAlwaysOn) ||
+                        (hScroll == WebCoreScrollbarAuto && documentSize.width + [NSScroller scrollerWidth] > frameSize.width);
+                else {
+                    scrollsHorizontally = (hScroll == WebCoreScrollbarAlwaysOn) ||
+                        (hScroll == WebCoreScrollbarAuto && documentSize.width > frameSize.width);
+                    if (scrollsHorizontally)
+                        scrollsVertically = (vScroll == WebCoreScrollbarAlwaysOn) ||
+                            (vScroll == WebCoreScrollbarAuto && documentSize.height + [NSScroller scrollerWidth] > frameSize.height);
+                }
             }
         } else {
             scrollsHorizontally = (hScroll == WebCoreScrollbarAuto) ? hasHorizontalScroller : (hScroll == WebCoreScrollbarAlwaysOn);