mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 20:42:40 +00:00
Use @autoreleasepool to avoid accumulating objects
This commit is contained in:
parent
0b37d23c37
commit
5ba071e760
@ -1,5 +1,5 @@
|
||||
// SHE library
|
||||
// Copyright (C) 2015-2016 David Capello
|
||||
// Copyright (C) 2015-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -19,6 +19,7 @@ void OSXEventQueue::getEvent(Event& ev, bool canWait)
|
||||
{
|
||||
ev.setType(Event::None);
|
||||
|
||||
@autoreleasepool {
|
||||
retry:;
|
||||
NSApplication* app = [NSApplication sharedApplication];
|
||||
if (!app)
|
||||
@ -56,6 +57,7 @@ retry:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OSXEventQueue::queueEvent(const Event& ev)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
// SHE library
|
||||
// Copyright (C) 2012-2016 David Capello
|
||||
// Copyright (C) 2012-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -113,6 +113,7 @@ public:
|
||||
}
|
||||
|
||||
void updateWindow(const gfx::Rect& bounds) {
|
||||
@autoreleasepool {
|
||||
int scale = this->scale();
|
||||
NSView* view = m_window.contentView;
|
||||
[view setNeedsDisplayInRect:
|
||||
@ -122,6 +123,7 @@ public:
|
||||
bounds.h*scale)];
|
||||
[view displayIfNeeded];
|
||||
}
|
||||
}
|
||||
|
||||
void setTranslateDeadKeys(bool state) {
|
||||
OSXView* view = (OSXView*)m_window.contentView;
|
||||
@ -304,7 +306,7 @@ private:
|
||||
return;
|
||||
|
||||
bitmap.lockPixels();
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSGraphicsContext* gc = [NSGraphicsContext currentContext];
|
||||
CGContextRef cg = (CGContextRef)[gc graphicsPort];
|
||||
CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID());
|
||||
|
Loading…
x
Reference in New Issue
Block a user