source: trunk/dports/aqua/emacs-app/files/patch-mavericks-memleak.diff @ 116837

Last change on this file since 116837 was 116837, checked in by hum@…, 6 years ago

emacs-app: add patchfiles for Mavericks; see #41224 and #42383.

File size: 2.1 KB
  • src/nsterm.h

    along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 
    5555/* We override sendEvent: as a means to stop/start the event loop */
    5656@interface EmacsApp : NSApplication
    5757{
     58#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
     59  BOOL shouldKeepRunning;
     60  BOOL isFirst;
     61#endif
    5862}
    5963- (void)logNotification: (NSNotification *)notification;
    6064- (void)sendEvent: (NSEvent *)theEvent;
  • src/nsterm.m

    diff --git a/src/nsterm.m b/src/nsterm.m
    index a57e744..324f065 100644
    ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) 
    33733373  if ([NSApp modalWindow] != nil)
    33743374    return -1;
    33753375
    3376   if (hold_event_q.nr > 0) 
     3376  if (hold_event_q.nr > 0)
    33773377    {
    33783378      int i;
    33793379      for (i = 0; i < hold_event_q.nr; ++i)
    ns_select (int nfds, fd_set *readfds, fd_set *writefds, 
    34473447
    34483448/*  NSTRACE (ns_select); */
    34493449
    3450   if (hold_event_q.nr > 0) 
     3450  if (hold_event_q.nr > 0)
    34513451    {
    34523452      /* We already have events pending. */
    34533453      kill (0, SIGIO);
    ns_term_shutdown (int sig) 
    42704270
    42714271@implementation EmacsApp
    42724272
     4273#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
     4274- (id)init
     4275{
     4276  if (self = [super init])
     4277    self->isFirst = YES;
     4278
     4279  return self;
     4280}
     4281
     4282- (void)run
     4283{
     4284    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     4285
     4286    if (isFirst) [self finishLaunching];
     4287    isFirst = NO;
     4288
     4289    shouldKeepRunning = YES;
     4290    do
     4291    {
     4292        [pool release];
     4293        pool = [[NSAutoreleasePool alloc] init];
     4294
     4295        NSEvent *event =
     4296          [self nextEventMatchingMask:NSAnyEventMask
     4297                            untilDate:[NSDate distantFuture]
     4298                               inMode:NSDefaultRunLoopMode
     4299                              dequeue:YES];
     4300        [self sendEvent:event];
     4301        [self updateWindows];
     4302    } while (shouldKeepRunning);
     4303
     4304    [pool release];
     4305}
     4306
     4307- (void)stop: (id)sender
     4308{
     4309    shouldKeepRunning = NO;
     4310}
     4311#endif
     4312
    42734313- (void)logNotification: (NSNotification *)notification
    42744314{
    42754315  const char *name = [[notification name] UTF8String];
Note: See TracBrowser for help on using the repository browser.