From 3726a408fa6043f1c1d9d1f05ae20fca1283d43c Mon Sep 17 00:00:00 2001 From: Jamie Doornbos Date: Tue, 10 Jun 2008 18:24:33 +0000 Subject: [PATCH] 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 --- .../com/threerings/crowd/server/PlaceManager.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/crowd/server/PlaceManager.java b/src/java/com/threerings/crowd/server/PlaceManager.java index 33a16fd00..dde2c064a 100644 --- a/src/java/com/threerings/crowd/server/PlaceManager.java +++ b/src/java/com/threerings/crowd/server/PlaceManager.java @@ -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); }