[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 461ac0815c 1/2: Fix crashes on ordinary menus on macOS
From: |
Po Lu |
Subject: |
master 461ac0815c 1/2: Fix crashes on ordinary menus on macOS |
Date: |
Sun, 8 May 2022 07:43:26 -0400 (EDT) |
branch: master
commit 461ac0815c153778c41f3074e8d7748754ff7dd9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix crashes on ordinary menus on macOS
* src/nsmenu.m ([EmacsMenu runMenuAt:forFrame:keymaps:]): Fix
coding style.
([EmacsMenu menu:willHighlightItem:]): Ignore if this is a
context menu.
---
src/nsmenu.m | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/nsmenu.m b/src/nsmenu.m
index b0ab12bb87..34864f9408 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -741,15 +741,15 @@ prettify_key (const char *key)
/* p = [view convertPoint:p fromView: nil]; */
p.y = NSHeight ([view frame]) - p.y;
e = [[view window] currentEvent];
- event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown
- location: p
- modifierFlags: 0
- timestamp: [e timestamp]
- windowNumber: [[view window] windowNumber]
- context: nil
- eventNumber: 0 /* [e eventNumber] */
- clickCount: 1
- pressure: 0];
+ event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown
+ location: p
+ modifierFlags: 0
+ timestamp: [e timestamp]
+ windowNumber: [[view window] windowNumber]
+ context: nil
+ eventNumber: 0 /* [e eventNumber] */
+ clickCount: 1
+ pressure: 0];
context_menu_value = -1;
[NSMenu popUpContextMenu: self withEvent: event forView: view];
@@ -767,6 +767,10 @@ prettify_key (const char *key)
Lisp_Object vec = f->menu_bar_vector;
Lisp_Object help, frame;
+ /* This isn't a menubar, ignore. */
+ if (context_menu_value == -1)
+ return;
+
if (idx >= ASIZE (vec))
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 461ac0815c 1/2: Fix crashes on ordinary menus on macOS,
Po Lu <=