emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110045: Try to fix crashes introduce


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110045: Try to fix crashes introduced by rev 109972.
Date: Sun, 16 Sep 2012 11:11:50 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110045
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-16 11:11:50 +0200
message:
  Try to fix crashes introduced by rev 109972.
  
  * nsfns.m (Fx_open_connection): Move initialization of ns_*_types
  to ns_term_init to avoid memory leak.
  
  * nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use
  explicit retain/release.
  (ns_term_init): Only allow one display.  Initialize outerpool and
  ns_*_types.
modified:
  src/ChangeLog
  src/nsfns.m
  src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-15 08:45:27 +0000
+++ b/src/ChangeLog     2012-09-16 09:11:50 +0000
@@ -1,3 +1,13 @@
+2012-09-16  Jan Djärv  <address@hidden>
+
+       * nsfns.m (Fx_open_connection): Move initialization of ns_*_types
+       to ns_term_init to avoid memory leak.
+
+       * nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use
+       explicit retain/release.
+       (ns_term_init): Only allow one display.  Initialize outerpool and
+       ns_*_types.
+
 2012-09-15  Paul Eggert  <address@hidden>
 
        Port _setjmp fix to POSIXish hosts as well as Microsoft.

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2012-09-15 07:06:56 +0000
+++ b/src/nsfns.m       2012-09-16 09:11:50 +0000
@@ -1796,19 +1796,6 @@
                SSDATA (display));
     }
 
-  /* Register our external input/output types, used for determining
-     applicable services and also drag/drop eligibility. */
-  ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
-  ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
-                      retain];
-  ns_drag_types = [[NSArray arrayWithObjects:
-                            NSStringPboardType,
-                            NSTabularTextPboardType,
-                            NSFilenamesPboardType,
-                            NSURLPboardType,
-                            NSColorPboardType,
-                            NSFontPboardType, nil] retain];
-
   return Qnil;
 }
 

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2012-09-15 07:06:56 +0000
+++ b/src/nsterm.m      2012-09-16 09:11:50 +0000
@@ -627,7 +627,7 @@
 {
   NSView *view = FRAME_NS_VIEW (f);
   NSRect r = [view frame];
-  NSBezierPath *bp = [NSBezierPath bezierPath];
+  NSBezierPath *bp;
   NSTRACE (ns_update_begin);
 
   ns_update_auto_hide_menu_bar ();
@@ -639,8 +639,9 @@
      is for the minibuffer.  But the display engine may draw more because
      we have set the frame as garbaged.  So reset clip path to the whole
      view.  */
-  [bp appendBezierPathWithRect: r];
+  bp = [[NSBezierPath bezierPathWithRect: r] retain];
   [bp setClip];
+  [bp release];
 
 #ifdef NS_IMPL_GNUSTEP
   uRect = NSMakeRect (0, 0, 0, 0);
@@ -3976,33 +3977,35 @@
   static int ns_initialized = 0;
   Lisp_Object tmp;
 
+  if (ns_initialized) return x_display_list;
+  ns_initialized = 1;
+
   NSTRACE (ns_term_init);
 
+  [outerpool release];
+  outerpool = [[NSAutoreleasePool alloc] init];
+
   /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */
   /*GSDebugAllocationActive (YES); */
   BLOCK_INPUT;
   handling_signal = 0;
 
-  if (!ns_initialized)
+  baud_rate = 38400;
+  Fset_input_interrupt_mode (Qnil);
+
+  if (selfds[0] == -1)
     {
-      baud_rate = 38400;
-      Fset_input_interrupt_mode (Qnil);
-
-      if (selfds[0] == -1)
+      if (pipe (selfds) == -1)
         {
-          if (pipe (selfds) == -1)
-            {
-              fprintf (stderr, "Failed to create pipe: %s\n",
-                       emacs_strerror (errno));
-              emacs_abort ();
-            }
-
-          fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL));
-          FD_ZERO (&select_readfds);
-          FD_ZERO (&select_writefds);
-          pthread_mutex_init (&select_mutex, NULL);
+          fprintf (stderr, "Failed to create pipe: %s\n",
+                   emacs_strerror (errno));
+          emacs_abort ();
         }
-      ns_initialized = 1;
+
+      fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL));
+      FD_ZERO (&select_readfds);
+      FD_ZERO (&select_writefds);
+      pthread_mutex_init (&select_mutex, NULL);
     }
 
   ns_pending_files = [[NSMutableArray alloc] init];
@@ -4193,6 +4196,20 @@
   }
 #endif /* MAC OS X menu setup */
 
+  /* Register our external input/output types, used for determining
+     applicable services and also drag/drop eligibility. */
+  ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
+  ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
+                      retain];
+  ns_drag_types = [[NSArray arrayWithObjects:
+                            NSStringPboardType,
+                            NSTabularTextPboardType,
+                            NSFilenamesPboardType,
+                            NSURLPboardType,
+                            NSColorPboardType,
+                            NSFontPboardType, nil] retain];
+
+  
   [NSApp run];
   ns_do_open_file = YES;
   return dpyinfo;


reply via email to

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