Fix Use-after-release found by static analyser.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32159 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-02-14 18:38:11 +00:00
parent c9a8e3c3ae
commit f58e9c1d39
4 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2011-02-14 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCursor.m,
* Source/GSDragView.m,
* Source/GSMemoryPanel.m: Fix Use-after-release found by static analyser.
2011-02-10 German Arias <german@xelalug.org>
* Source/GSGormLoader.m (+initialize): Load the app icon here, at launch

View file

@ -141,15 +141,15 @@ static GSDragView *sharedDragView = nil;
if (self != nil)
{
NSRect winRect = {{0, 0}, {DWZ, DWZ}};
NSWindow *sharedDragWindow = [[isa windowClass] alloc];
NSWindow *sharedDragWindow = [[[isa windowClass] alloc]
initWithContentRect: winRect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreNonretained
defer: NO];
dragCell = [[NSCell alloc] initImageCell: nil];
[dragCell setBordered: NO];
[sharedDragWindow initWithContentRect: winRect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreNonretained
defer: NO];
[sharedDragWindow setContentView: self];
// Kept alive by the window
RELEASE(self);

View file

@ -374,9 +374,11 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil;
peak = GSDebugAllocationPeak (pointer[i]);
/* Insert into array */
entry = [GSMemoryPanelEntry alloc];
[entry initWithString: className count: count
total: total peak: peak];
entry = [[GSMemoryPanelEntry alloc]
initWithString: className
count: count
total: total
peak: peak];
[array addObject: entry];
RELEASE (entry);
i++;

View file

@ -296,6 +296,7 @@ NSCursor *getStandardCursor(NSString *name, int style)
cursor = [[NSCursor_class alloc] initWithImage: nil];
[GSCurrentServer() standardcursor: GSArrowCursor : &c];
// FIXME: This make the cursor active
[GSCurrentServer() setcursorcolor: [NSColor greenColor]
: [NSColor blackColor] : c];
[cursor _setCid: c];
@ -344,7 +345,10 @@ foregroundColorHint:(NSColor *)fg
backgroundColorHint:(NSColor *)bg
hotSpot:(NSPoint)hotSpot
{
NSCursor *cursor = [self initWithImage: newImage hotSpot: hotSpot];
self = [self initWithImage: newImage hotSpot: hotSpot];
if (self == nil)
return nil;
if (fg || bg)
{
if (bg == nil)
@ -353,9 +357,10 @@ backgroundColorHint:(NSColor *)bg
fg = [NSColor blackColor];
bg = [bg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
fg = [fg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
// FIXME: This make the cursor active
[GSCurrentServer() setcursorcolor: fg : bg : _cid];
}
return cursor;
return self;
}
- (void) dealloc
{