• 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: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:


  • Subject: Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
  • From: Jerry Krinock <email@hidden>
  • Date: Mon, 18 Jan 2010 22:58:16 -0800

On 2010 Jan 18, at 09:14, Jerry Krinock wrote:

> - (BOOL)isDocumentEdited
> {
>    return (_changeCount > 0) ;
> }
>
> Am I correct?

No, I was wrong.  After getting the ivar offset from otool, I poked around with gdb and found that _changeCount can actually be negative.  This occurs if you do several edits, save the document, then start Undoing.  Exactly as specified by -updateChangeCount documentation, the _changeCount decrements, to -1, -2, etc.

The behavior does seem to be

- (BOOL)isDocumentEdited
{
   return (_changeCount != 0) ;
}

I also confirmed another undocumented fact that I suspected, which is that sending -updateChangeCount:NSChangeRedone causes changeCount to increment.


_______________________________________________

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

References: 
 >Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount: (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Moderated post on self going out of scope
  • Next by Date: NSDrawNinePartImage autorelease problem
  • Previous by thread: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
  • Next by thread: Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
  • Index(es):
    • Date
    • Thread