Closed herlihalim closed 10 years ago
Just ran into this issue, too.
Since g_instancesReadLock
and g_instances
seem to be designed to stick around forever after they have been created and since creating a semaphore and a dictionary is very inexpensive, I think it would be reasonable to just initialise them in +initialize
.
This would also mean we could remove the several calls to +uniqueMapInit
scattered across various FCModel methods.
A temporary workaround for anyone facing this problem right now would be to just declare +[FCModel uniqueMapInit]
somewhere and call it when you open your database (no worries, it won't do any damage if it's called multiple times).
If you open a database and close it before any operation is done to it. It'll crash due to g_instancesReadLock hasn't been initialised yet, as there hasn't been any chance to call
uniqueMapInit
yet.