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


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

bug #39300: Updating NSUserDefaults doesn't update

Submitted by:  Michael Silva <msilvax28>
Submitted on:  Thu 20 Jun 2013 03:57:11 PM UTC  
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Fri 06 Sep 2013 09:47:29 AM UTC, 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 07 Aug 2013 07:00:04 PM UTC, 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 26 Jul 2013 10:51:37 AM UTC, comment #2:

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

Richard Frith-Macdonald <CaS>
Project Member
Thu 27 Jun 2013 06:53:24 AM UTC, 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 20 Jun 2013 03:57:11 PM UTC, 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 (1KiB - application/x-gzip)


Depends on the following items: None found

Items that depend on this one: None found


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

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

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-06 CaS StatusNone => Fixed
        Open/ClosedOpen => Closed
    2013-08-07 msilvax28 Attached File- => Added cachedDefaults.tar.gz, #28787

    Back to the top

    Powered by Savane 3.3