Re: MyDocument instance variables, dealloc problems
Re: MyDocument instance variables, dealloc problems
- Subject: Re: MyDocument instance variables, dealloc problems
- From: Keary Suska <email@hidden>
- Date: Sun, 12 Nov 2006 12:15:35 -0700
- Thread-topic: MyDocument instance variables, dealloc problems
on 11/11/06 11:28 PM, email@hidden purportedly said:
> The first document created by my app upon opening works fine.
> However, if I open another document, it's instance variables seem to
> be completely messed up. Specifically, one of the instance
> variables, myWindow, is an IBOutlet set in the nib file to point to
> the window for the document. Somehow, the instance docWindow ends up
> pointing to (seemingly) random other objects in the second (and
> third, etc) document created in my app.
In a typical document-based application, a new and different window is
created for each "document". This is accomplished by loading the document
nib. Therefore the outlet for each document *should* be pointing to a new
window.
> This creates serious problems including hard crashes for obvious reasons when
> the program tries to do things to/with to docWindow. This odd behavior goes
> away if I never set possibleColumns. Any idea why this might be?
What are the contents of possibleColumns, more more specifically, what are
the contents of the dict that you are passing to the setter? Simply calling
a method should effect anything that is not explicitly in the code, unless
you are using bindings. This response also applies to below.
> Further confusing matters, MyDocument's dealloc method doesn't get
> called when a document window is closed. However, if I remove the
> retain message in the setPossibleColumns: method, then MyDocument's
> dealloc method does get called. Of course, I need to retain
> possibleDocuments otherwise it ends up getting released out from
> under MyDocument when I need it. Why should the presence or absence
> of [possibleColumns retain]; in that setter method (and that's the
> only line I'm changing in the whole project) change whether or not
> dealloc gets called on MyDocument? Removing the retain message also
> causes the problems with instance variables in later documents being
> corrupt to disappear, but again, if I don't retain possibleColumns I
> get crashes related to accessing a released object.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden