зеркало из https://github.com/mozilla/pjs.git
Fix crashes when window closed with key-combination (alters previous fix to work on both Tiger and Leopard). b=396860 r=joshmoz sr=roc a=dsicore
This commit is contained in:
Родитель
ccb50b04c5
Коммит
c3c1989ae5
|
@ -4025,16 +4025,8 @@ static BOOL keyUpAlreadySentKeyDown = NO;
|
|||
if (!mGeckoChild || nsTSMManager::IsComposing())
|
||||
return NO;
|
||||
|
||||
// Retain and release our native window to avoid crashes when it's closed
|
||||
// as a result of processing a key equivalent (e.g. Command+w or Command+q).
|
||||
NSWindow *ourNativeWindow = [self nativeWindow];
|
||||
if (ourNativeWindow)
|
||||
ourNativeWindow = [ourNativeWindow retain];
|
||||
// see if the menu system will handle the event
|
||||
BOOL menuRetval = [[NSApp mainMenu] performKeyEquivalent:theEvent];
|
||||
if (ourNativeWindow)
|
||||
[ourNativeWindow release];
|
||||
if (menuRetval)
|
||||
if ([[NSApp mainMenu] performKeyEquivalent:theEvent])
|
||||
return YES;
|
||||
|
||||
// don't handle this if certain modifiers are down - those should
|
||||
|
|
|
@ -1315,6 +1315,18 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput()
|
|||
geckoWindow->DispatchEvent(&guiEvent, status);
|
||||
}
|
||||
|
||||
// Retain and release "self" to avoid crashes when our widget (and its native
|
||||
// window) is closed as a result of processing a key equivalent (e.g.
|
||||
// Command+w or Command+q). This workaround is only needed for a window
|
||||
// that can become key.
|
||||
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
|
||||
{
|
||||
NSWindow *nativeWindow = [self retain];
|
||||
BOOL retval = [super performKeyEquivalent:theEvent];
|
||||
[nativeWindow release];
|
||||
return retval;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PopupWindow
|
||||
|
@ -1494,4 +1506,16 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput()
|
|||
return YES;
|
||||
}
|
||||
|
||||
// Retain and release "self" to avoid crashes when our widget (and its native
|
||||
// window) is closed as a result of processing a key equivalent (e.g.
|
||||
// Command+w or Command+q). This workaround is only needed for a window
|
||||
// that can become key.
|
||||
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
|
||||
{
|
||||
NSWindow *nativeWindow = [self retain];
|
||||
BOOL retval = [super performKeyEquivalent:theEvent];
|
||||
[nativeWindow release];
|
||||
return retval;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Загрузка…
Ссылка в новой задаче