mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-22 06:41:08 +00:00
Fix memory leaks changing custom native cursors on macOS
This commit is contained in:
parent
8691345f03
commit
0b37d23c37
@ -187,6 +187,7 @@ using namespace she;
|
||||
}
|
||||
}
|
||||
|
||||
@autoreleasepool {
|
||||
CGDataProviderRef dataRef =
|
||||
CGDataProviderCreateWithData(nullptr, &buf[0],
|
||||
w*h*4, nullptr);
|
||||
@ -206,18 +207,19 @@ using namespace she;
|
||||
NSCursor* nsCursor = nullptr;
|
||||
if (img) {
|
||||
NSImage* image =
|
||||
[[NSImage new] initWithCGImage:img
|
||||
[[NSImage alloc] initWithCGImage:img
|
||||
size:NSMakeSize(w, h)];
|
||||
CGImageRelease(img);
|
||||
|
||||
nsCursor =
|
||||
[[NSCursor new] initWithImage:image
|
||||
[[NSCursor alloc] initWithImage:image
|
||||
hotSpot:NSMakePoint(scale*focus.x + scale/2,
|
||||
scale*focus.y + scale/2)];
|
||||
}
|
||||
if (nsCursor)
|
||||
[self.contentView setCursor:nsCursor];
|
||||
return (nsCursor ? YES: NO);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)noResponderFor:(SEL)eventSelector
|
||||
|
Loading…
x
Reference in New Issue
Block a user