Bug 1365825: Fix occasional crashes on OSX when handling custom shortcuts. r=mstange

This commit is contained in:
Stephen A Pohl 2017-05-18 15:37:01 -04:00
Родитель b63c15138b
Коммит ce1514ce6c
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -1284,9 +1284,7 @@ nsChildView::PostHandleKeyEvent(mozilla::WidgetKeyboardEvent* aEvent)
// not handled we give menu items a chance to act. This allows for handling of
// custom shortcuts. Note that existing shortcuts cannot be reassigned yet and
// will have been handled by keyDown: before we get here.
NSEvent* cocoaEvent =
[sNativeKeyEventsMap objectForKey:@(aEvent->mUniqueId)];
[sNativeKeyEventsMap removeObjectForKey:@(aEvent->mUniqueId)];
NSEvent* cocoaEvent = [sNativeKeyEventsMap objectForKey:@(aEvent->mUniqueId)];
if (!cocoaEvent) {
return;
}
@ -1294,6 +1292,7 @@ nsChildView::PostHandleKeyEvent(mozilla::WidgetKeyboardEvent* aEvent)
if (SendEventToNativeMenuSystem(cocoaEvent)) {
aEvent->PreventDefault();
}
[sNativeKeyEventsMap removeObjectForKey:@(aEvent->mUniqueId)];
NS_OBJC_END_TRY_ABORT_BLOCK;
}