[bug #46956] Thread safety issues in NSUserDefaults.m cause unwarranted exceptions to be raised

Larry Campbell <[email protected]>
Newsgroups gmane.comp.lib.gnustep.bugs
Message-ID <[email protected]>
Follow-up Comment #1, bug #46956 (project gnustep):

(sorry for the formatting; don't know how to get bugzilla to preserve
indentation)

Part, but not all, of the problem is that parsingArguments is being protected
by the _lock ivar, but because parsingArguments is file static, and you can
have multiple NSUserDefaults objects in play, that's not sufficient. You need
to use classLock here.

But you can still end up with the second thread trying to call
_createArgumentDictionary getting a nil arguments dictionary. Since my
applications don't use that, I stopped there. I'll shortly be attaching a
patch that fixes that, and that adds a sleep-and-retry loop for the case where
some thread needs the standardUserDefaults but another thread is still in the
process of creating it. We probably need a similar sleep-and-retry loop for
_createArgumentDictionary but I didn't go that far because, as I said, I don't
use it.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?46956>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.