RESOLVED FIXED 146501
[Mac] Numerous CGColor leaks in swipe gestures
https://bugs.webkit.org/show_bug.cgi?id=146501
Summary [Mac] Numerous CGColor leaks in swipe gestures
Joseph Pecoraro
Reported 2015-07-01 00:40:49 PDT
* SUMMARY [Mac] Numerous CGColor leaks in swipe gestures Unsure of the exact steps to reproduce. * LEAK Leak: 0x7ffee400cfb0 size=80 zone: DefaultMallocZone_0x10ab96000 CGColor CFType CoreGraphics Call stack: [thread 0x10aa86000]: | 0x1 | start | NSApplicationMain | -[NSApplication run] | -[BrowserApplication sendEvent:] | -[NSApplication sendEvent:] | -[BrowserWindow sendEvent:] | -[Window sendEvent:] | -[NSWindow sendEvent:] | -[NSWindow _reallySendEvent:isDelayedEvent:] | -[BrowserWKView scrollWheel:] | -[WKView scrollWheel:] | WebKit::ViewGestureController::handleScrollWheelEvent(NSEvent*) | WebKit::ViewGestureController::trackSwipeGesture(NSEvent*, WebKit::ViewGestureController::SwipeDirection) | -[NSEvent trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:] | -[NSEvent _trackSwipeEventWithOptions:dampenAmountThresholdMin:max:trackingDistance:axis:velocityFilterClass:usingHandler:] | ___trackSwipeWithScrollEvent_block_invoke | ___ZN6WebKit21ViewGestureController17trackSwipeGestureEP7NSEventNS0_14SwipeDirectionE_block_invoke | WebKit::ViewGestureController::beginSwipeGesture(WebKit::WebBackForwardListItem*, WebKit::ViewGestureController::SwipeDirection) | CGColorCreateGenericGray | create_color | CGTypeCreateInstance | _CFRuntimeCreateInstance | malloc_zone_malloc * NOTES - ViewGestureController::beginSwipeGesture certainly looks like it leaks: [m_swipeShadowLayer setColors:@[ (id)CGColorCreateGenericGray(0, 1.), (id)CGColorCreateGenericGray(0, 0.99), (id)CGColorCreateGenericGray(0, 0.98), (id)CGColorCreateGenericGray(0, 0.95), ... ]];
Attachments
[PATCH] Proposed Fix (3.15 KB, patch)
2015-07-01 00:56 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2015-07-01 00:41:03 PDT
What is the elegant way to do this without leaking? Is it this? (id)adoptCF(CGColorCreateGenericGray(...)).get()
Joseph Pecoraro
Comment 2 2015-07-01 00:56:51 PDT
Created attachment 255908 [details] [PATCH] Proposed Fix Seems to work!
Tim Horton
Comment 3 2015-07-01 01:06:53 PDT
Comment on attachment 255908 [details] [PATCH] Proposed Fix Woah, good catch. Thankfully never shipped.
WebKit Commit Bot
Comment 4 2015-07-01 01:55:59 PDT
Comment on attachment 255908 [details] [PATCH] Proposed Fix Clearing flags on attachment: 255908 Committed r186174: <http://trac.webkit.org/changeset/186174>
WebKit Commit Bot
Comment 5 2015-07-01 01:56:03 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 6 2015-07-01 09:39:32 PDT
Comment on attachment 255908 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=255908&action=review > Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:640 > + (id)adoptCF(CGColorCreateGenericGray(0, 1.)).get(), Cries out for a helper function.
Note You need to log in before you can comment on or make changes to this bug.