emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117308: Fix memory leaks


From: Jan D.
Subject: [Emacs-diffs] trunk r117308: Fix memory leaks
Date: Wed, 11 Jun 2014 17:57:54 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117308
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17751
committer: Jan Djärv <address@hidden>
branch nick: trunk
timestamp: Wed 2014-06-11 19:57:51 +0200
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/macfont.m                  macfont.m-20130915173740-04lgloz0557bz98l-2
  src/nsterm.h                   nsterm.h-20091113204419-o5vbwnq5f7feedwu-8746
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-06-10 05:28:00 +0000
+++ b/src/ChangeLog     2014-06-11 17:57:51 +0000
@@ -1,3 +1,13 @@
+2014-06-11  Jan Djärv  <address@hidden>
+
+       * nsterm.h (EmacsApp): Always compile in shouldKeepRunning, isFirst
+       on Cocoa.
+
+       * nsterm.m (run): Always compile for Cocoa.  Use runtime check to
+       determine 10.9 (Bug#17751).
+
+       * macfont.m (macfont_draw): positions where not freed.
+
 2014-06-10  Dmitry Antipov  <address@hidden>
 
        * dispextern.h (PREPARE_FACE_FOR_DISPLAY): Remove as a duplicate of ...

=== modified file 'src/macfont.m'
--- a/src/macfont.m     2014-05-25 10:28:52 +0000
+++ b/src/macfont.m     2014-06-11 17:57:51 +0000
@@ -2810,6 +2810,7 @@
 
 
   xfree (glyphs);
+  xfree (positions);
   CGContextRestoreGState (context);
 
   unblock_input ();

=== modified file 'src/nsterm.h'
--- a/src/nsterm.h      2014-06-04 14:59:09 +0000
+++ b/src/nsterm.h      2014-06-11 17:57:51 +0000
@@ -100,7 +100,7 @@
 /* We override sendEvent: as a means to stop/start the event loop */
 @interface EmacsApp : NSApplication
 {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
+#ifdef NS_IMPL_COCOA
   BOOL shouldKeepRunning;
   BOOL isFirst;
 #endif

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2014-06-04 14:59:09 +0000
+++ b/src/nsterm.m      2014-06-11 17:57:51 +0000
@@ -4453,7 +4453,7 @@
 {
   if (self = [super init])
     {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
+#ifdef NS_IMPL_COCOA
       self->isFirst = YES;
 #endif
 #ifdef NS_IMPL_GNUSTEP
@@ -4464,30 +4464,40 @@
   return self;
 }
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
+#ifdef NS_IMPL_COCOA
 - (void)run
 {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
-    if (isFirst) [self finishLaunching];
-    isFirst = NO;
-
-    shouldKeepRunning = YES;
-    do
-      {
-        [pool release];
-        pool = [[NSAutoreleasePool alloc] init];
-
-        NSEvent *event =
-          [self nextEventMatchingMask:NSAnyEventMask
-                            untilDate:[NSDate distantFuture]
-                               inMode:NSDefaultRunLoopMode
-                              dequeue:YES];
-        [self sendEvent:event];
-        [self updateWindows];
+#ifndef NSAppKitVersionNumber10_8
+#define NSAppKitVersionNumber10_8 1187
+#endif
+
+  if (NSAppKitVersionNumber <= NSAppKitVersionNumber10_8) 
+    {
+      [super run];
+      return;
+    }
+
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+  if (isFirst) [self finishLaunching];
+  isFirst = NO;
+
+  shouldKeepRunning = YES;
+  do
+    {
+      [pool release];
+      pool = [[NSAutoreleasePool alloc] init];
+
+      NSEvent *event =
+        [self nextEventMatchingMask:NSAnyEventMask
+                          untilDate:[NSDate distantFuture]
+                             inMode:NSDefaultRunLoopMode
+                            dequeue:YES];
+      [self sendEvent:event];
+      [self updateWindows];
     } while (shouldKeepRunning);
-
-    [pool release];
+  
+  [pool release];
 }
 
 - (void)stop: (id)sender
@@ -4497,7 +4507,7 @@
     // The file dialog still leaks 7k - 10k on 10.9 though.
     [super stop:sender];
 }
-#endif
+#endif /* NS_IMPL_COCOA */
 
 - (void)logNotification: (NSNotification *)notification
 {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]