Fix tab dragging crashing under 10.14 due to deprecated API

Use the newer `cacheDisplayInRect:toBitmapImageRep:` API instead to work
around this.
This commit is contained in:
Yee Cheng Chin
2018-11-24 04:11:08 -08:00
parent e5d11768a2
commit e126fa9652
@@ -338,7 +338,10 @@
if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"]))
cellFrame.size.width += 1.0;
[_controlView lockFocus];
NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:cellFrame] autorelease];
NSBitmapImageRep *rep = [[self controlView] bitmapImageRepForCachingDisplayInRect:cellFrame];
[[self controlView] cacheDisplayInRect:cellFrame toBitmapImageRep:rep];
[_controlView unlockFocus];
NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
[image addRepresentation:rep];