mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-20 15:06:24 +00:00
Raise an exception in init methods when called with nil nib file name
or nil owner git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11087 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1b792f83c7
commit
cd967093fd
1 changed files with 19 additions and 8 deletions
|
@ -34,7 +34,19 @@
|
|||
|
||||
- (id) initWithWindowNibName: (NSString *)windowNibName owner: (id)owner
|
||||
{
|
||||
[self initWithWindow: nil];
|
||||
if (windowNibName == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to init NSWindowController with nil windowNibName"];
|
||||
}
|
||||
|
||||
if (owner == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to init NSWindowController with nil owner"];
|
||||
}
|
||||
|
||||
self = [self initWithWindow: nil];
|
||||
ASSIGN (_windowNibName, windowNibName);
|
||||
_owner = owner;
|
||||
return self;
|
||||
|
@ -42,7 +54,7 @@
|
|||
|
||||
- (id) initWithWindow: (NSWindow *)window
|
||||
{
|
||||
[super init];
|
||||
self = [super init];
|
||||
|
||||
ASSIGN (_window, window);
|
||||
_windowFrameAutosaveName = @"";
|
||||
|
@ -59,7 +71,7 @@
|
|||
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithWindowNibName: nil];
|
||||
return [self initWithWindow: nil];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -147,7 +159,7 @@
|
|||
{
|
||||
[_window setWindowController: nil];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If the window is set to isReleasedWhenClosed, it will release
|
||||
* itself, so nil out our reference so we don't release it again
|
||||
|
@ -158,10 +170,9 @@
|
|||
* crashes if isReleaseWhenClosed is set.
|
||||
*/
|
||||
if ([_window isReleasedWhenClosed])
|
||||
{
|
||||
_window = nil;
|
||||
}
|
||||
|
||||
{
|
||||
_window = nil;
|
||||
}
|
||||
[_document _removeWindowController: self];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue