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

Group
 
 

bug #39300: Updating NSUserDefaults doesn't update

Submitter:  Michael Silva <msilvax28>
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>
Group 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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    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.13-f8d8.
    Corresponding source code