Hi,
I came across a "funny" issue in NSLocale.
Whenever NSLocale reacts on a "defaultsDidChange" notification, it sets
the _components attributes of the "autoupdatingLocale" instance to nil
and also sets the currentLocale to nil.
Next time when the currentLocale instance is queried, it is retrieved
from the "allLocales". The instance returned from there has a
_components attribute that is nil. This leads to disaster.
_components could be nil just because it always was or because it was
the "autoupdatingLocale" instance and so it was reset in the
notification, I didn't dive into that. Instead of that I added the
attached patch.
Comments welcome.
Regards,
Mathias
Index: NSLocale.m
===================================================================
--- NSLocale.m (revision 37628)
+++ NSLocale.m (working copy)
@@ -771,6 +771,8 @@
{
[self release];
self = [newLocale retain];
+ if (!self->_components)
+ self->_components = [[NSMutableDictionary alloc] initWithCapacity:
0];
}
[classLock unlock];
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep