mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
* Source/NSMenuView.m (-mouseDown:): Protect against _window going
away during tracking.
This commit is contained in:
parent
7b819af623
commit
6e417da18e
2 changed files with 12 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
|||
2020-11-29 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSMenuView.m (-mouseDown:): Protect against _window going
|
||||
away during tracking.
|
||||
|
||||
2020-11-03 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSBitmapImageRep+JPEG.m (_JPEGRepresentationWithProperties:):
|
||||
|
|
|
@ -1981,9 +1981,6 @@ static float menuBarHeight = 0.0;
|
|||
*/
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSRect currentFrame;
|
||||
NSRect originalFrame;
|
||||
NSPoint currentTopLeft;
|
||||
NSPoint originalTopLeft = NSZeroPoint; /* Silence compiler. */
|
||||
BOOL restorePosition;
|
||||
/*
|
||||
|
@ -1992,9 +1989,10 @@ static float menuBarHeight = 0.0;
|
|||
*/
|
||||
restorePosition = ![_attachedMenu isTransient];
|
||||
|
||||
if (restorePosition)
|
||||
{ // store old position;
|
||||
originalFrame = [_window frame];
|
||||
if (restorePosition && (nil != _window))
|
||||
{
|
||||
// store old position;
|
||||
NSRect originalFrame = [_window frame];
|
||||
originalTopLeft = originalFrame.origin;
|
||||
originalTopLeft.y += originalFrame.size.height;
|
||||
}
|
||||
|
@ -2003,10 +2001,10 @@ static float menuBarHeight = 0.0;
|
|||
[self trackWithEvent: theEvent];
|
||||
[NSEvent stopPeriodicEvents];
|
||||
|
||||
if (restorePosition)
|
||||
if (restorePosition && (nil != _window))
|
||||
{
|
||||
currentFrame = [_window frame];
|
||||
currentTopLeft = currentFrame.origin;
|
||||
NSRect currentFrame = [_window frame];
|
||||
NSPoint currentTopLeft = currentFrame.origin;
|
||||
currentTopLeft.y += currentFrame.size.height;
|
||||
|
||||
if (NSEqualPoints(currentTopLeft, originalTopLeft) == NO)
|
||||
|
|
Loading…
Reference in a new issue