CocoaDev

Edit AllPages

I’ve got some problem with programmatically creating a window showing a NSOutlineView object.

For some reason I do not want to use Interface Builder to create that window and view. Somehow I manage to bring the window including the outline view on screen. For that I need to use alloc-method several times. Going on in the program I want to hide only the NSOutlineView object (with NSScrollView and NSClipView) and freeing the memory. The window should stay alive. I tried to use release at appropriate times. But, PROBLEM: when I release one of the views after its retainCount is down to 1, so it should be deallocated now, my application is crashing. Error message: myApplication has exited due to signal 11 (SIGSEGV)

Can anyone please explain to me, how I can create the needed NSOutlineView and deallocate it the right way?

Strange observation: the crashing occours only when I use setDocumentView- or setContentView-method.

here is my test code that does not work:


MyOutlineView.h:

#import <Cocoa/Cocoa.h> @interface MyOutlineView : NSObject { NSWindow *window; NSScrollView *scrollView; }


MyOutlineView.m:

#import “MyOutlineView.h” @implementation MyOutlineView