Re: MyDocument instance variables, dealloc problems
Re: MyDocument instance variables, dealloc problems
- Subject: Re: MyDocument instance variables, dealloc problems
- From: Andrew Madsen <email@hidden>
- Date: Sun, 12 Nov 2006 12:46:37 -0700
Thanks for your help Mike,
This is in a fairly big project, so posting an example probably isn't
too practical, especially since I'm not sure what's causing this
problem. However, I can add some more information. I'm not
purposely registering document windows for notification, but that
might somehow be happening behind the scenes. possibleColumns
contains an array of NSTableColumns which are added to/removed from a
table in the document window. All of the columns are added to the
table in IB. When the document window loads up, all of those columns
are added to possibleColumns (for later use), then those that are not
set to be visible according to preferences are removed from the
table. A contextual menu for the table header has a list of columns
so they can be added and removed by the user (like in iTunes). If
the user enables a column that isn't currently in the table, the
handler method for the menu gets it from possibleColumns and adds it
to the table header.
Before I added the code to handle all of this stuff, the application
was working fine. This problem seems to be related to
possibleColumns. Does that give any better clue as to the possible
source of the problem? I am not exactly sure what to do about retain/
release of the columns themselves. The NSArray possibleColumns
should retain them when they are added to it, then send a release
message to them when possibleColumns itself is released, right? I'm
a little concerned because like I said, if I set possibleColumns to
anything (or retain it at least), then MyDocument's dealloc never
gets called, so neither possibleColumns, nor the other instance
variables ever get released.
-Andrew
On Nov 12, 2006, at 9:10 AM, j o a r wrote:
Well to me from that error message, it looks like you are
registering your document windows for some sort of notification.
When the window is released, you need to de-register these
notifcations. If you don't, the notification centre attempts to
send them to the now non-existent window causing the issue you're
seeing.
Some sort of example project would help though.
Mike.
_______________________________________________
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