• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mixing UIDocument's NSUndoManager and -updateChangeCount:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing UIDocument's NSUndoManager and -updateChangeCount:


  • Subject: Re: Mixing UIDocument's NSUndoManager and -updateChangeCount:
  • From: Markus Spoettl <email@hidden>
  • Date: Mon, 13 Jan 2014 18:24:36 +0100

On 1/13/14 5:29 PM, Kyle Sluder wrote:
This does not strike me as a good idea. -updateChangeCount: is a
counter; adding a place that increments the counter without having a
corresponding decrement sounds like an invitation for state corruption,
particularly in the presence of framework code that treats the counter
as normal.

Are you sure this is how it works? Reading the constants' documentation (especially that of UIDocumentChangeCleared) doesn't seem to imply that there is strict counter balancing going on:

----------
UIDocumentChangeCleared
The document is cleared of outstanding changes.
----------

To me it more sounds like the change counter is reset, regardless of how it got incremented.

Plus Mike doesn't seem to think that either (not proof of course).

It would be better to add a flag to your UIDocument subclass that you
set whenever the user changes a non-undoable model property, and
override -hasUnsavedChanges to return the OR of this property and
super's return value.

The point of this is I'm trying to find a way around the necessity of tracking the settings for changes. We're talking about a bazillion of highly complex settings objects, not just 10 bools. Also, if I did that, I could easily use the undo manager and add appropriate changes.

Of course I could overwrite -hasUnsavedChanges. But I want it to return YES (in addition to super returning YES) if and only if the app is being backgrounded and the system is trying to save changes as a result of that. That requires me to know when that happens, and I don't.

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Mixing UIDocument's NSUndoManager and -updateChangeCount:
      • From: Kyle Sluder <email@hidden>
References: 
 >Mixing UIDocument's NSUndoManager and -updateChangeCount: (From: Markus Spoettl <email@hidden>)
 >Re: Mixing UIDocument's NSUndoManager and -updateChangeCount: (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: RSA and libcrypto
  • Next by Date: Re: NSTableView, NSArrayController predicate, change data exception
  • Previous by thread: Re: Mixing UIDocument's NSUndoManager and -updateChangeCount:
  • Next by thread: Re: Mixing UIDocument's NSUndoManager and -updateChangeCount:
  • Index(es):
    • Date
    • Thread