Re: Changing content object (class) for NSObjectController
Re: Changing content object (class) for NSObjectController
- Subject: Re: Changing content object (class) for NSObjectController
- From: Doug Knowles <email@hidden>
- Date: Sat, 30 Apr 2005 17:09:54 -0400
Hmm, no response; here's a followup.
I can call NSObjectController's setContent all day, passing an
instance of one type of object (a "master" object in my app), but the
first time I select (and pass to setContent) a different type (my
"detail" object), setContent hangs with the following stack trace.
#0 0x901c0b4c in CFRelease
#1 0x901c7f08 in CFDictionaryRemoveAllValues
#2 0x901c7f08 in CFDictionaryRemoveAllValues
#3 0x901d5fa8 in __CFDictionaryDeallocate
#4 0x901c0cd0 in CFRelease
#5 0x90ac5f8c in -[NSObject(NSKeyValueObserverRegistration)
addObserver:forKeyPath:options:context:]
#6 0x9325fa98 in -[_NSModelObservingTracker
_registerOrUnregister:observerNotificationsForModelObject:]
#7 0x9328aa84 in -[NSObjectController setContent:]
#8 0x0046d574 in -[AppController setInspectorTarget:] at AppController.m:71
#9 0x0046db7c in -[AppController tableViewSelectionDidChange:] at
AppController.m:134
#10 0x90a27b14 in _nsnote_callback
#11 0x901da5a0 in __CFXNotificationPost
#12 0x901defb0 in _CFXNotificationPostNotification
#13 0x90a25960 in -[NSNotificationCenter postNotificationName:object:userInfo:]
#14 0x92f0e174 in -[NSTableView _enableSelectionPostingAndPost]
#15 0x92f2e2bc in -[NSTableView mouseDown:]
#16 0x92eb2b08 in -[NSWindow sendEvent:]
#17 0x92ea51b4 in -[NSApplication sendEvent:]
#18 0x92ead5e4 in -[NSApplication run]
#19 0x92f69cc4 in NSApplicationMain
#20 0x00088f74 in main at main.m:13
The "smells" like a memory management problem (hanging in CFRelease).
I think I understand Cocoa memory management (which may be more
dangerous than knowing I don't understand it...), and the detail
objects (that don't work) are being managed the same way as the master
objects (that do work).
Does the stack trace ring any bells or prompt any suggestions?
TIA,
Doug K;
On 4/27/05, Doug Knowles <email@hidden> wrote:
> Hi, all,
>
> I have a typical application UI consisting of a window containing two
> tables implementing a classic master/detail arrangement, and a
> separate inspector ("Get Info...") window to display properties of a
> selected object. The fields of the inspector are bound to a
> NSObjectController.
>
> If I click around in my "master" table, calling NSObjectController
> setContent causes the inspector to correctly display the properties of
> the selected "master" object, and I can also get the "detail"
> pane/table to correctly update with a list of the objects contained in
> the selected master object.
>
> However, when I click on a "detail" object in the second pane, and
> pass the selected object to the controller's setContent, the app locks
> up. If I call "content" immediately after "setContent", it returns
> the "old" master object that was last passed to the controller. I'm
> 99% confident that the new content object is already retained; I've
> even tried retaining it explicitly while it serves as the content
> object.
>
> Any thoughts about what I should be looking for?
>
> TIA,
> Doug K;
>
_______________________________________________
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