Skip to content
Permalink
Browse files
<http://webkit.org/b/59725> -[WebFullscreenWindow initWithContentRect…
…:styleMask:backing:defer:] leaks a CALayer

Reviewed by Dan Bernstein.

* WebView/WebFullScreenController.mm:
(-[WebFullscreenWindow initWithContentRect:styleMask:backing:defer:]):
Use a RetainPtr to hold the CALayer and to fix the leak.

Canonical link: https://commits.webkit.org/74959@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ddkilzer committed Apr 28, 2011
1 parent 3d8afc0 commit 1d4117210f6d4ee072b7679686ac600eb1de496e
Showing with 17 additions and 6 deletions.
  1. +10 −0 Source/WebKit/mac/ChangeLog
  2. +7 −6 Source/WebKit/mac/WebView/WebFullScreenController.mm
@@ -1,3 +1,13 @@
2011-04-28 David Kilzer <ddkilzer@apple.com>

<http://webkit.org/b/59725> -[WebFullscreenWindow initWithContentRect:styleMask:backing:defer:] leaks a CALayer

Reviewed by Dan Bernstein.

* WebView/WebFullScreenController.mm:
(-[WebFullscreenWindow initWithContentRect:styleMask:backing:defer:]):
Use a RetainPtr to hold the CALayer and to fix the leak.

2011-04-28 David Kilzer <ddkilzer@apple.com>

Follow-up fix: <http://webkit.org/b/59727> -[WebPDFView menuForEvent:] leaks NSMenuItem objects
@@ -52,6 +52,7 @@
#import <WebCore/RenderLayer.h>
#import <WebCore/RenderLayerBacking.h>
#import <objc/objc-runtime.h>
#import <wtf/RetainPtr.h>
#import <wtf/UnusedParam.h>

static const NSTimeInterval tickleTimerInterval = 1.0;
@@ -799,20 +800,20 @@ - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backi
NSView* contentView = [self contentView];
_animationView = [[NSView alloc] initWithFrame:[contentView bounds]];

CALayer* contentLayer = [[CALayer alloc] init];
[_animationView setLayer:contentLayer];
RetainPtr<CALayer> contentLayer(AdoptNS, [[CALayer alloc] init]);
[_animationView setLayer:contentLayer.get()];
[_animationView setWantsLayer:YES];
[_animationView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[contentView addSubview:_animationView];

_backgroundLayer = [[CALayer alloc] init];
[contentLayer addSublayer:_backgroundLayer];
[contentLayer.get() addSublayer:_backgroundLayer];
#ifndef BUILDING_ON_LEOPARD
[contentLayer setGeometryFlipped:YES];
[contentLayer.get() setGeometryFlipped:YES];
#else
[contentLayer setSublayerTransform:CATransform3DMakeScale(1, -1, 1)];
[contentLayer.get() setSublayerTransform:CATransform3DMakeScale(1, -1, 1)];
#endif
[contentLayer setOpacity:0];
[contentLayer.get() setOpacity:0];

[_backgroundLayer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
[_backgroundLayer setOpacity:0];

0 comments on commit 1d41172

Please sign in to comment.