« WOCommon r489, 2 items changed | Main | WOCommon r491, 2 items changed »
April 27, 2007
WOCommon r490, 2 items changed
r1485@cuzco (orig r239): wincent | 2006-12-22 20:17:52 +0100 WOSingleton class now uses NSMapTable instead of an NSMutableDictionary because it can be configured to not copy the keys (seeing as the keys were class objects this was not really correct or a very elegant thing to do). In making this change discovered and fixed a subtle race condition in certain circumstances: the order in which constructors are called is not determinate (or at least it is not publicly documented) so it was possible for another singleton class such as WOLogManager to call the WOSingleton class's sharedInstance method from it's constructor function before WOSingleton's constructor function had been called and before the singleton registry had been set up. Also, the switch to map tables permitted the use of NSMapInsertKnownAbsent which in turn revealed that the sharedInstance and allocWithZone methods were both trying to add the same entry to the singleton registry; this was harmless but redundant so one of the redundant calls has been removed.
Posted by wincent at April 27, 2007 7:06 PM