Changeset 20152 in webkit


Ignore:
Timestamp:
Mar 13, 2007 11:22:43 AM (17 years ago)
Author:
darin
Message:

Reviewed by Tim Hatcher and John Sullivan.

  • fix <rdar://problem/4915303> CrashTracer: 36 crashes in Safari at com.apple.AppKit: -[NSView getRectsBeingDrawn:count:] + 502
  • page/mac/FrameMac.mm: (WebCore::Frame::imageFromRect): This was calling drawRect: directly, but NSView's getRectsBeingDrawn:count: method was never really safe to call unless it was AppKit that called your drawRect: method. Changed it to call drawSingleRect: instead. A little ugly, but seems to work and will almost certainly fix the bug.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r20151 r20152  
     12007-03-13  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Tim Hatcher and John Sullivan.
     4
     5        - fix <rdar://problem/4915303> CrashTracer: 36 crashes in Safari at
     6          com.apple.AppKit: -[NSView getRectsBeingDrawn:count:] + 502
     7
     8        * page/mac/FrameMac.mm: (WebCore::Frame::imageFromRect):
     9        This was calling drawRect: directly, but NSView's getRectsBeingDrawn:count:
     10        method was never really safe to call unless it was AppKit that called your
     11        drawRect: method. Changed it to call drawSingleRect: instead. A little ugly,
     12        but seems to work and will almost certainly fix the bug.
     13
    1142007-03-13  Nikolas Zimmermann  <zimmermann@kde.org>
    215
  • trunk/WebCore/page/mac/FrameMac.mm

    r20108 r20152  
    11/*
    2  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    44 * Copyright (C) 2007 Trolltech ASA
     
    100100@end
    101101 
     102@interface NSView (WebCoreHTMLDocumentView)
     103- (void)drawSingleRect:(NSRect)rect;
     104@end
     105 
    102106using namespace std;
    103107using namespace KJS::Bindings;
     
    325329    if (!view)
    326330        return nil;
     331    if (![view respondsToSelector:@selector(drawSingleRect:)])
     332        return nil;
    327333   
    328334    NSImage* resultImage;
     
    342348        [resultImage setFlipped:YES];
    343349        [resultImage lockFocus];
    344 
    345350        CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
    346 
    347351        CGContextSaveGState(context);
    348352        CGContextTranslateCTM(context, bounds.origin.x - rect.origin.x, bounds.origin.y - rect.origin.y);
    349         [view drawRect:rect];
     353
     354        // Note: Must not call drawRect: here, because drawRect: assumes that it's called from AppKit's
     355        // display machinery. It calls getRectsBeingDrawn:count:, which can only be called inside
     356        // when a real AppKit display is underway.
     357        [view drawSingleRect:rect];
     358
    350359        CGContextRestoreGState(context);
    351360        [resultImage unlockFocus];
Note: See TracChangeset for help on using the changeset viewer.