mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Ensure proper order of actions when loading a .nib file and make sure
all objects are instantiated before establishing any connections. This fixes an issue where, e.g., a generic shared document controller instance is created before a custom instance defined in the nib file. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30376 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ed30b6221a
commit
809a378e24
2 changed files with 35 additions and 14 deletions
|
@ -1,3 +1,11 @@
|
|||
2010-05-13 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/GSNibLoading.m (-nibInstantiateWithOwner:topLeveObjects:):
|
||||
Make sure all objects are instantiated before establishing any
|
||||
connections. This fixes an issue where, e.g., a generic shared
|
||||
document controller instance is created before a custom instance
|
||||
defined in the nib file.
|
||||
|
||||
2010-05-12 18:48-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h: Added method
|
||||
|
|
|
@ -1888,19 +1888,12 @@ static BOOL _isInInterfaceBuilder = NO;
|
|||
// set the new root object.
|
||||
[_root setRealObject: owner];
|
||||
|
||||
// iterate over connections, instantiate and then establish them.
|
||||
en = [_connections objectEnumerator];
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
{
|
||||
if ([obj respondsToSelector: @selector(instantiateWithInstantiator:)])
|
||||
{
|
||||
[obj instantiateWithInstantiator: self];
|
||||
[obj establishConnection];
|
||||
}
|
||||
}
|
||||
|
||||
// iterate over all objects, instantiate, awaken objects and fill
|
||||
// in top level array.
|
||||
// iterate over all objects, instantiate them and fill in top level array.
|
||||
/* Note: We instantiate all objects before establishing any connections
|
||||
between them, so that any shared instances defined in the nib are
|
||||
initialized before being used. This sequence is important when, e.g.,
|
||||
the nib defines a shared document controller that is an instance of a
|
||||
subclass of NSDocumentController. */
|
||||
objs = NSAllMapTableKeys(_objects);
|
||||
en = [objs objectEnumerator];
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
|
@ -1916,8 +1909,28 @@ static BOOL _isInInterfaceBuilder = NO;
|
|||
// objects on behalf of the owner.
|
||||
RETAIN(obj);
|
||||
}
|
||||
}
|
||||
|
||||
// awaken the object.
|
||||
// iterate over connections, instantiate and then establish them.
|
||||
en = [_connections objectEnumerator];
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
{
|
||||
if ([obj respondsToSelector: @selector(instantiateWithInstantiator:)])
|
||||
{
|
||||
[obj instantiateWithInstantiator: self];
|
||||
[obj establishConnection];
|
||||
}
|
||||
}
|
||||
|
||||
// awaken all objects.
|
||||
objs = NSAllMapTableKeys(_objects);
|
||||
en = [objs objectEnumerator];
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
{
|
||||
if ([obj respondsToSelector: @selector(realObject)])
|
||||
{
|
||||
obj = [obj realObject];
|
||||
}
|
||||
if ([obj respondsToSelector: @selector(awakeFromNib)])
|
||||
{
|
||||
[obj awakeFromNib];
|
||||
|
|
Loading…
Reference in a new issue