mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17276 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5f452ad56f
commit
5d38cbe75d
5 changed files with 55 additions and 33 deletions
|
@ -3,6 +3,11 @@
|
|||
* Source/NSFileWrapper.m: Tidy initialisation and fix leak in
|
||||
dealloc.
|
||||
* Source/NSTextAttachment.m: ditto.
|
||||
* Source/NSGraphicsContext.m: Memory leak fixes (suggested by Andrew
|
||||
Ruder) and initialisation tidyups.
|
||||
* Source/NSInputManager.m: ditto
|
||||
* Source/NSOpenPanel.m: ditto
|
||||
|
||||
|
||||
2003-07-19 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
TEST_RELEASE(_filename);
|
||||
TEST_RELEASE(_fileAttributes);
|
||||
TEST_RELEASE(_preferredFilename);
|
||||
TEST_RELEASE(_wrapperData);
|
||||
TEST_RELEASE(_iconImage);
|
||||
|
|
|
@ -249,6 +249,7 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
DESTROY(usedFonts);
|
||||
DESTROY(focus_stack);
|
||||
DESTROY(context_data);
|
||||
DESTROY(context_info);
|
||||
|
@ -257,32 +258,35 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithContextInfo: NULL];
|
||||
return [self initWithContextInfo: nil];
|
||||
}
|
||||
|
||||
/* designated initializer for the NSGraphicsContext class */
|
||||
/** <init />
|
||||
*/
|
||||
- (id) initWithContextInfo: (NSDictionary *)info
|
||||
{
|
||||
[super init];
|
||||
|
||||
ASSIGN(context_info, info);
|
||||
focus_stack = [[NSMutableArray allocWithZone: [self zone]]
|
||||
initWithCapacity: 1];
|
||||
usedFonts = nil;
|
||||
|
||||
/*
|
||||
* The classMethodTable dictionary and the list of all contexts must both
|
||||
* be protected from other threads.
|
||||
*/
|
||||
[contextLock lock];
|
||||
if (!(methods = [[classMethodTable objectForKey: [self class]] pointerValue]))
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
methods = [[self class] _initializeMethodTable];
|
||||
[classMethodTable setObject: [NSValue valueWithPointer: methods]
|
||||
forKey: [self class]];
|
||||
}
|
||||
[contextLock unlock];
|
||||
ASSIGN(context_info, info);
|
||||
focus_stack = [[NSMutableArray allocWithZone: [self zone]]
|
||||
initWithCapacity: 1];
|
||||
usedFonts = nil;
|
||||
|
||||
/*
|
||||
* The classMethodTable dictionary and the list of all contexts must both
|
||||
* be protected from other threads.
|
||||
*/
|
||||
[contextLock lock];
|
||||
methods = [[classMethodTable objectForKey: [self class]] pointerValue];
|
||||
if (methods == 0)
|
||||
{
|
||||
methods = [[self class] _initializeMethodTable];
|
||||
[classMethodTable setObject: [NSValue valueWithPointer: methods]
|
||||
forKey: [self class]];
|
||||
}
|
||||
[contextLock unlock];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -367,15 +371,14 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
return;
|
||||
|
||||
if (usedFonts == nil)
|
||||
usedFonts = RETAIN([NSMutableSet setWithCapacity: 2]);
|
||||
usedFonts = [[NSMutableSet alloc] initWithCapacity: 2];
|
||||
|
||||
[usedFonts addObject: name];
|
||||
}
|
||||
|
||||
- (void) resetUsedFonts
|
||||
{
|
||||
if (usedFonts)
|
||||
[usedFonts removeAllObjects];
|
||||
[usedFonts removeAllObjects];
|
||||
}
|
||||
|
||||
- (NSSet *) usedFonts
|
||||
|
|
|
@ -473,6 +473,7 @@ static NSInputManager *currentInputManager = nil;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
TEST_RELEASE (_pendingKeyEvents);
|
||||
RELEASE (_rootBindingTable);
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
|
@ -79,15 +79,19 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
{
|
||||
BOOL found = YES;
|
||||
|
||||
if (_fileTypes)
|
||||
if (_fileTypes != nil)
|
||||
{
|
||||
if ([_fileTypes containsObject: extension] == YES)
|
||||
{
|
||||
if ([self treatsFilePackagesAsDirectories] == NO)
|
||||
*isDir = NO;
|
||||
{
|
||||
*isDir = NO;
|
||||
}
|
||||
}
|
||||
else
|
||||
found = NO;
|
||||
{
|
||||
found = NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (*isDir == YES || (found == YES && _canChooseFiles == YES))
|
||||
|
@ -274,15 +278,23 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
return _gs_gui_open_panel;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
TEST_RELEASE(_fileTypes);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
[super init];
|
||||
_canChooseDirectories = YES;
|
||||
_canChooseFiles = YES;
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_canChooseDirectories = YES;
|
||||
_canChooseFiles = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// dealloc is the same as NSSavePanel
|
||||
|
||||
/*
|
||||
* Filtering Files
|
||||
|
@ -427,7 +439,7 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
ASSIGN (_fileTypes, fileTypes);
|
||||
|
||||
return [self runModalForDirectory: path
|
||||
file: name];
|
||||
file: name];
|
||||
}
|
||||
|
||||
- (int)runModalForDirectory:(NSString *)path
|
||||
|
@ -438,8 +450,8 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
ASSIGN (_fileTypes, fileTypes);
|
||||
|
||||
return [self runModalForDirectory: path
|
||||
file: name
|
||||
relativeToWindow: window];
|
||||
file: name
|
||||
relativeToWindow: window];
|
||||
}
|
||||
|
||||
- (void)beginSheetForDirectory:(NSString *)path
|
||||
|
|
Loading…
Reference in a new issue