git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4920 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-09-20 19:17:12 +00:00
parent 1c21a9c09a
commit 8171e4cc22
2 changed files with 14 additions and 32 deletions

View file

@ -4,7 +4,7 @@ Mon Sep 20 1999 Nicola Pero <n.pero@mi.flashnet.it>
the width or height of the argument is negative, but don't crash
the app. ([-setFrame:]): idem.
Modified by RFM to apply to all other cases of checking view size
also, retain NSAssert() to give core dump wieh built for debugging.
and also to add debug logging for all those cases.
Mon Sep 20 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>

View file

@ -44,6 +44,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSDebug.h>
#include <AppKit/NSView.h>
#include <AppKit/NSWindow.h>
@ -190,16 +191,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
[super init];
NSAssert(frameRect.size.width >= 0 && frameRect.size.height >= 0,
@"illegal frame dimensions supplied");
if (frameRect.size.width < 0)
{
NSLog(@"[NSView -initWithFrame:] given negative width");
NSDebugMLLog(@"NSView", @"given negative width", 0);
frameRect.size.width = 0;
}
if (frameRect.size.height < 0)
{
NSLog(@"[NSView -initWithFrame:] given negative height");
NSDebugMLLog(@"NSView", @"given negative height", 0);
frameRect.size.height = 0;
}
frame = frameRect; // Set frame rectangle
@ -546,16 +545,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
NSSize old_size = frame.size;
NSAssert(frameRect.size.width >= 0 && frameRect.size.height >= 0,
@"illegal frame dimensions supplied");
if (frameRect.size.width < 0)
{
NSLog(@"[NSView -setFrame:] given negative width");
NSDebugMLLog(@"NSView", @"given negative width", 0);
frameRect.size.width = 0;
}
if (frameRect.size.height < 0)
{
NSLog(@"[NSView -setFrame:] given negative heigth");
NSDebugMLLog(@"NSView", @"given negative height", 0);
frameRect.size.height = 0;
}
if (coordinates_valid)
@ -588,16 +585,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
NSSize old_size = frame.size;
NSAssert(newSize.width >= 0 && newSize.height >= 0,
@"illegal frame dimensions supplied");
if (newSize.width < 0)
{
NSLog(@"[NSView -setFrameSize:] given negative width");
NSDebugMLLog(@"NSView", @"given negative width", 0);
newSize.width = 0;
}
if (newSize.height < 0)
{
NSLog(@"[NSView -setFrameSize:] given negative height");
NSDebugMLLog(@"NSView", @"given negative height", 0);
newSize.height = 0;
}
if (coordinates_valid)
@ -649,15 +644,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
float sx;
float sy;
NSAssert(newSize.width > 0 && newSize.height > 0, @"illegal size supplied");
if (newSize.width < 0)
{
NSLog(@"[NSView -scaleUnitSquareToSize:] given negative width");
NSDebugMLLog(@"NSView", @"given negative width", 0);
newSize.width = 0;
}
if (newSize.height < 0)
{
NSLog(@"[NSView -scaleUnitSquareToSize:] given negative height");
NSDebugMLLog(@"NSView", @"given negative height", 0);
newSize.height = 0;
}
if (coordinates_valid)
@ -704,16 +698,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
float sx, sy;
NSAssert(aRect.size.width >= 0 && aRect.size.height >= 0,
@"illegal bounds dimensions supplied");
if (aRect.size.width < 0)
{
NSLog(@"[NSView -setBounds:] given negative width");
NSDebugMLLog(@"NSView", @"given negative width", 0);
aRect.size.width = 0;
}
if (aRect.size.height < 0)
{
NSLog(@"[NSView -setBounds:] given negative height");
NSDebugMLLog(@"NSView", @"given negative height", 0);
aRect.size.height = 0;
}
if (coordinates_valid)
@ -775,30 +767,20 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{
float sx, sy;
NSAssert(newSize.width >= 0 && newSize.height >= 0,
@"illegal bounds dimensions supplied");
if (newSize.width < 0)
{
NSLog(@"[NSView -setBoundsSize:] given negative width");
NSDebugMLLog(@"NSView", @"given negative width", 0);
newSize.width = 0;
}
if (newSize.height < 0)
{
NSLog(@"[NSView -setBoundsSize:] given negative height");
NSDebugMLLog(@"NSView", @"given negative height", 0);
newSize.height = 0;
}
if (coordinates_valid)
{
(*invalidateImp)(self, invalidateSel);
}
if (newSize.width == 0)
{
NSLog(@"[NSView -setBoundsSize:] zero width supplied");
}
if (newSize.height == 0)
{
NSLog(@"[NSView -setBoundsSize:] zero height supplied");
}
bounds.size = newSize;