help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] Releasing objects owned by Gorm interface element


From: Gregory John Casamento
Subject: Re: [Q] Releasing objects owned by Gorm interface element
Date: Thu, 9 Dec 2004 13:05:41 -0800 (PST)

--- Samuel Hornus <prenomdotnomdotinriadotfr@nospam.com> wrote:

> Gregory wrote:
> > It is the responsibility of the app to release certain top level
> > objects contain in the nib (in this place, gorm) file.
> > 
> > Here is a good place to start: 
> >http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResou
> >rces/Concepts/NibFileLoaded.html
> 
> > You need to maintain a connection to any windows, menus, controllers
> > or other toplevel objects you have created.   Generally, these are the
> > objects you see in  IB/Gorm in the "Objects View".
> > 
> > Please make sure you are correctly deallocating these.
> 
> Hi Gregory,
> Thank your for the link.
> I discovered the - (BOOL)applicationShouldTerminate:(id)sender
> that can be implemented into the NSApp's delegate.
> 
> In this method, I am able to release my custom view. This works.
> 
> My interface has one button, one custom view, the main menu; I guess I
> don't have to release the main Menu and the button manually, am I right
> ?

That's correct.   The Menu is retained by the NSApplication instance and
released there.   All the windows and other top level objects should be
released by your application.   The button is retained by the view it is in.  
Once the window is released all views within it are automatically released.

> Then, the only object left is the NSApp's delegate itself. It is
> instanciated it Gorm and set as the App's delegate in Gorm as well. How
> can I properly release this delegate ?
> 
> For the moment, I implemented this as follows...
> is that correct ?

I don't see anything wrong with the code below. 

> // Application's delegate implementation :
> 
> // The Log can be seen when I quit the App, cool :-)
> - (void)dealloc
> {
>     NSLog(@"Fairing Manager is deallocating...");
>     [view release]; // view is my Custom NVOpenGLView
>     [super dealloc];
> }
> 
> - (NSApplicationTerminateReply)applicationShouldTerminate:(id)sender
> {
>     [self release];
>     return NSTerminateNow;
> }
> 
> regards,
> -- 
> Samuel Hornus
> _______________________________________________
> Help-gnustep mailing list
> Help-gnustep@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnustep
> 


=====
Gregory John Casamento 
-- CEO/President Open Logic Corp. (A Maryland Corporation)
#### Maintainer of Gorm for GNUstep.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]