• 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
Undo Causes Document Window to be Retained
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Undo Causes Document Window to be Retained


  • Subject: Undo Causes Document Window to be Retained
  • From: Scott Johnson <email@hidden>
  • Date: Wed, 10 Oct 2001 11:00:57 -0400

I have a document-based Cocoa application I've been working on that is written in Objective-C. I am seeing instances where the following line of code causes the document window to be retained.

[[[self undoManager] prepareWithInvocationTarget:self] <someMethod>:<itsParameter>];

In this case, _self_ is the NSDocument-derived object. For reasons I don't quite understand the window for this document object is retained when updateChangeCount is called (as a result of the above call). The problem is, it does not ever seem to be released; when the window is closed by the user the application crashes because the OS is trying to later redisplay the contents of a window which isn't there (but was never fully released). I have no explicit code to retain or release the window object. I have added code to removeAllActions from the undoManager hoping that this would cause it to release the window to no avail.

My questions are thus:

1. What would cause updateChangeCount to retain the window?

2. Why isn't the window released when the document is closed (assuming the retain was for a valid purpose)?

Thanks for any insight you may have on this.

-Scott


  • Prev by Date: Re: Rendering a View into an Image
  • Next by Date: Re: NSMatrix Questions (was:Re: Another Table View Question)
  • Previous by thread: two level namespace q
  • Next by thread: Re: NSMatrix Questions (was:Re: Another Table View Question)
  • Index(es):
    • Date
    • Thread