aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsterm.m
diff options
context:
space:
mode:
authorJan Djärv2014-06-11 19:57:51 +0200
committerJan Djärv2014-06-11 19:57:51 +0200
commitb765f1fe83a0df149ad783f7dae8ea01f71e680d (patch)
tree0127dee3bd4121488daf5162de9f4140e8517b9e /src/nsterm.m
parent15684f524b58e19fc7d44b09db0d15a8f582118a (diff)
downloademacs-b765f1fe83a0df149ad783f7dae8ea01f71e680d.tar.gz
emacs-b765f1fe83a0df149ad783f7dae8ea01f71e680d.zip
Fix memory leaks
* macfont.m (macfont_draw): positions where not freed. * nsterm.h (EmacsApp): Always compile in shouldKeepRunning, isFirst on Cocoa. * nsterm.m (run): Always compile for Cocoa. Use runtime check to determine 10.9. Fixes: debbugs:17751
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m52
1 files changed, 31 insertions, 21 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 6b617be4c0d..c6450804f57 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4453,7 +4453,7 @@ ns_term_shutdown (int sig)
4453{ 4453{
4454 if (self = [super init]) 4454 if (self = [super init])
4455 { 4455 {
4456#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 4456#ifdef NS_IMPL_COCOA
4457 self->isFirst = YES; 4457 self->isFirst = YES;
4458#endif 4458#endif
4459#ifdef NS_IMPL_GNUSTEP 4459#ifdef NS_IMPL_GNUSTEP
@@ -4464,30 +4464,40 @@ ns_term_shutdown (int sig)
4464 return self; 4464 return self;
4465} 4465}
4466 4466
4467#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 4467#ifdef NS_IMPL_COCOA
4468- (void)run 4468- (void)run
4469{ 4469{
4470 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 4470#ifndef NSAppKitVersionNumber10_8
4471#define NSAppKitVersionNumber10_8 1187
4472#endif
4471 4473
4472 if (isFirst) [self finishLaunching]; 4474 if (NSAppKitVersionNumber <= NSAppKitVersionNumber10_8)
4473 isFirst = NO; 4475 {
4476 [super run];
4477 return;
4478 }
4474 4479
4475 shouldKeepRunning = YES; 4480 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
4476 do
4477 {
4478 [pool release];
4479 pool = [[NSAutoreleasePool alloc] init];
4480
4481 NSEvent *event =
4482 [self nextEventMatchingMask:NSAnyEventMask
4483 untilDate:[NSDate distantFuture]
4484 inMode:NSDefaultRunLoopMode
4485 dequeue:YES];
4486 [self sendEvent:event];
4487 [self updateWindows];
4488 } while (shouldKeepRunning);
4489 4481
4490 [pool release]; 4482 if (isFirst) [self finishLaunching];
4483 isFirst = NO;
4484
4485 shouldKeepRunning = YES;
4486 do
4487 {
4488 [pool release];
4489 pool = [[NSAutoreleasePool alloc] init];
4490
4491 NSEvent *event =
4492 [self nextEventMatchingMask:NSAnyEventMask
4493 untilDate:[NSDate distantFuture]
4494 inMode:NSDefaultRunLoopMode
4495 dequeue:YES];
4496 [self sendEvent:event];
4497 [self updateWindows];
4498 } while (shouldKeepRunning);
4499
4500 [pool release];
4491} 4501}
4492 4502
4493- (void)stop: (id)sender 4503- (void)stop: (id)sender
@@ -4497,7 +4507,7 @@ ns_term_shutdown (int sig)
4497 // The file dialog still leaks 7k - 10k on 10.9 though. 4507 // The file dialog still leaks 7k - 10k on 10.9 though.
4498 [super stop:sender]; 4508 [super stop:sender];
4499} 4509}
4500#endif 4510#endif /* NS_IMPL_COCOA */
4501 4511
4502- (void)logNotification: (NSNotification *)notification 4512- (void)logNotification: (NSNotification *)notification
4503{ 4513{