]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix crashes displaying menu help text on NS
authorPo Lu <luangruo@yahoo.com>
Tue, 31 May 2022 08:25:20 +0000 (16:25 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 31 May 2022 08:25:20 +0000 (16:25 +0800)
* src/nsterm.m (ns_flush_display): Run event loop manually,
avoiding a double free of an autorelease pool.

src/nsterm.m

index 3d2b4116cab49718786cfe41490d8cde30ab50d8..0c83656125cfcb15087f6b527757a331f7de6264 100644 (file)
@@ -5185,14 +5185,19 @@ ns_update_window_end (struct window *w, bool cursor_on_p,
 static void
 ns_flush_display (struct frame *f)
 {
-  struct input_event ie;
+  NSAutoreleasePool *ap;
+
+  ap = [[NSAutoreleasePool alloc] init];
 
   /* Called from some of the minibuffer code.  Run the event loop once
      to make the toolkit make changes that were made to the back
-     buffer visible again.  TODO: what should happen to ie?  */
+     buffer visible again.  */
 
-  EVENT_INIT (ie);
-  ns_read_socket (FRAME_TERMINAL (f), &ie);
+  send_appdefined = YES;
+  ns_send_appdefined (-1);
+
+  [NSApp run];
+  [ap release];
 }
 
 /* This and next define (many of the) public functions in this