mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Protect against [window screen] returning nil.
This commit is contained in:
parent
020d3fa183
commit
e3d51643ca
3 changed files with 20 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2017-10-05 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSMenu.m (-isPartlyOffScreen): Protect agains window or
|
||||
screen being nil.
|
||||
* Source/NSWindow.m (-_screenForFrame:): Try not to return nil, as
|
||||
other code uses the result without checks.
|
||||
|
||||
2017-10-01 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* Documentation/ReleaseNotes.gsdoc:
|
||||
|
|
|
@ -1545,7 +1545,7 @@ static BOOL menuBarVisible = YES;
|
|||
[_view sizeToFit];
|
||||
|
||||
menuFrame = [_view frame];
|
||||
|
||||
|
||||
// Main
|
||||
oldWindowFrame = [_aWindow frame];
|
||||
newWindowFrame = [NSWindow frameRectForContentRect: menuFrame
|
||||
|
@ -1855,7 +1855,15 @@ static BOOL menuBarVisible = YES;
|
|||
NSWindow *window;
|
||||
|
||||
window = [self window];
|
||||
return !NSContainsRect([[window screen] visibleFrame], [window frame]);
|
||||
if ((nil != window) && (nil != [window screen]))
|
||||
{
|
||||
return !NSContainsRect([[window screen] visibleFrame], [window frame]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Menu has no window %@ or screen %@", window, [window screen]);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _performMenuClose: (id)sender
|
||||
|
|
|
@ -389,7 +389,9 @@ has blocked and waited for events.
|
|||
*/
|
||||
- (NSScreen *) _screenForFrame: (NSRect)frame
|
||||
{
|
||||
CGFloat largest = 0.0;
|
||||
// FIXME: We always return the first screen, if there is no overlap.
|
||||
// Other code relies on [window screen] not returning nil.
|
||||
CGFloat largest = -1.0;
|
||||
NSArray *screens = [NSScreen screens];
|
||||
NSInteger index = 0;
|
||||
NSScreen *theScreen = nil;
|
||||
|
|
Loading…
Reference in a new issue