mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
32728903ff
commit
c89edd66b8
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user