bugGNUstep - Bugs: bug #39300, Updating NSUserDefaults doesn't...


You are not allowed to post comments on this tracker with your current authentification level.

bug #39300: Updating NSUserDefaults doesn't update

Submitted by:  Michael Silva <msilvax28>
Submitted on:  Thu Jun 20 15:57:11 2013  
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri Sep 6 09:47:29 2013, comment #4:

Thanks ... I think I fixed this in svn trunk.
If I'm right, the problem only occurred very rarely ... at the point when a new domain is created. Cache update was occurring properly for any existing domain, but not the first time a new domain was flushed to disk.

Richard Frith-Macdonald <CaS>
Project Member
Wed Aug 7 19:00:04 2013, comment #3:

See attached file. The program writes 2 plist file (test-1.plist and test-2.plist).

if no previous defaults are saved for the app test-1 should be in the 'native' GNUstep format. after test-1 is written the GSMacOSXCompatible flag is set to YES. Then test-2 is written. test-2 should be written as an OS X compatible (XML) plist, but it is not.

of course the 2nd run of the app will load the saved defaults, so both files will be XML format. so make sure to delete the defaults file for the app between runs.

(file #28787)

Michael Silva <msilvax28>
Fri Jul 26 10:51:37 2013, comment #2:

Can you please provide a tiny test/example program to reproduce this issue?

Richard Frith-Macdonald <CaS>
Project Member
Thu Jun 27 06:53:24 2013, comment #1:

I'm not sure about this ... after all these are cached items ... the point being to improve performance by not getting new values every time they are accessed.
However, I think the cache should be updated when the defaults system is synchronized, so if that's not happening, I guess there's a bug there.

Richard Frith-Macdonald <CaS>
Project Member
Thu Jun 20 15:57:11 2013, original submission:

v1.24.4 GNUstep base on Debian Wheezy x86:

if a program updates one of the 'cached' GSUserDefault defaults values defined in NSUserDefaults.m as:

static BOOL flags[GSUserDefaultMaxFlag] = { 0 };

the flags 'cache' of the value is not updated. Even after synchronizing the NSUserDefaults.

Thus the settings change doesn't take place until the program is exited and restarted.

I have a simple patch that calls updateCache(self) on every call to setObject:forKey:, but I don't know if that's really the right approach.

Michael Silva <msilvax28>


Attached Files
file #28787:  cachedDefaults.tar.gz added by msilvax28 (1kB - application/x-gzip)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by msilvax28 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Sep 6 09:47:29 2013CaSStatusNone=>Fixed
    Wed Aug 7 19:00:04 2013msilvax28Attached File-=>Added cachedDefaults.tar.gz, #28787

    Back to the top

    Powered by Savane 3.1-cleanup1