Fix error introduced in revision 5170

Place manager delegates now store their own references to the omgr and invmgr 
and set the members via the init function. This is fine, but due to the order
of calling PlaceManager's init and addDelegate, the PlaceManagerDelegate.init 
was receiving null values. 

The fix is to provied a more consistent guarantee about the relationship
between init and addDelegate. After both have been called (regardless of
order), we guarantee that both init and didInit have been called on all 
delegates.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5177 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-06-10 18:24:33 +00:00
parent ae5cda0ebf
commit 3726a408fa
@@ -182,6 +182,13 @@ public class PlaceManager
_omgr = omgr;
_config = config;
// initialize our delegates
applyToDelegates(new DelegateOp() {
public void apply (PlaceManagerDelegate delegate) {
delegate.init(PlaceManager.this, _omgr, _invmgr);
}
});
// let derived classes do initialization stuff
didInit();
}
@@ -194,7 +201,10 @@ public class PlaceManager
if (_delegates == null) {
_delegates = Lists.newArrayList();
}
delegate.init(this, _omgr, _invmgr);
if (_omgr != null) {
delegate.init(this, _omgr, _invmgr);
delegate.didInit(_config);
}
_delegates.add(delegate);
}