🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
5 messages
5 total messages Started by Gary Ritchie Mon, 27 Jul 1992 01:04
Destroying Zones
#248
Author: Gary Ritchie
Date: Mon, 27 Jul 1992 01:04
13 lines
1016 bytes
I'm loading a nib file into its own zone, so that I can later destroy the  
zone and make everything go away.  I'm having a problem because the nib  
file contains Windows, and the program has a segmentation fault shortly  
after the zone is destroyed.

I remember glancing at an article in the spring NeXTworld magazine which  
discussed how to deal with freeing zones which contain Windows, but I  
don't have access to that particular issue anymore.

Could someone give me a quick summary on the steps necessary?

Gary Ritchie
gary@niagara.ucs.ualberta.ca
Re: Destroying Zones
#255
Author: Ali Ozer
Date: Mon, 27 Jul 1992 14:39
20 lines
1446 bytes
In article <1992Jul27.010436.1749@kakwa.ucs.ualberta.ca> Gary Ritchie writes:
>I'm loading a nib file into its own zone, so that I can later destroy the  
>zone and make everything go away.

It's just a bad idea to destroy a zone which contains kit objects. Some kit
objects (including most of the interesting ones, such as Window, View, Font,
NXImage, etc --- objects you might easily encounter in a .nib file)
allocate resources or change some state.  Their -free method must be called to
dispose of them properly. Also, even if you're sure that a kit object's free
method doesn't do anything interesting, you are not guaranteed that this won't
change in the next release.

There are cases where destroying zones to get rid of objects will work.
If you have some simple object whose free simply frees itself or frees
other similary simple objects, and your collection of objects are all in
one zone, with no errant pointers into the zone and no unknown objects
in the zone, then you can probably destroy the zone to get rid of the objects,
avoiding many calls to free().

Ali, Ali_Ozer@NeXT.com
Re: Destroying Zones
#275
Author: moose
Date: Mon, 27 Jul 1992 16:48
27 lines
1667 bytes
In article <1992Jul27.010436.1749@kakwa.ucs.ualberta.ca>  
gary@niagara.ucs.ualberta.ca (Gary Ritchie) writes:
> I'm loading a nib file into its own zone, so that I can later destroy the  
> zone and make everything go away.  I'm having a problem because the nib  
> file contains Windows, and the program has a segmentation fault shortly  
> after the zone is destroyed.
> 
> I remember glancing at an article in the spring NeXTworld magazine which  
> discussed how to deal with freeing zones which contain Windows, but I  
> don't have access to that particular issue anymore.
> 
> Could someone give me a quick summary on the steps necessary?

Grab the entire window list and iterate through it.  You can find all the  
windows you want by doing a [[windowList objectAt:count] zone] == ZoneToDie.

Something to note, though, NeXT puts icons and sounds in whatever zone was  
active when the tiff was loaded.  But future loadings will not reload the tiff,  
but point to the already existing tiff.  Therefore, if you kill a zone, you  
will kill tiffs that other zones point into.


--
Michael Rutman			|	moose@svcdudes.com
Cubist				|	makes me a NeXT programmer
Software Ventures		|	maker of MicroPhone II
#include <std.disclaimer>
Re: Destroying Zones
#307
Author: Andrew Loewenstern
Date: Tue, 28 Jul 1992 19:20
21 lines
1311 bytes
In article <1992Jul27.010436.1749@kakwa.ucs.ualberta.ca> gary@niagara.ucs.ualberta.ca (Gary Ritchie) writes:
>I'm loading a nib file into its own zone, so that I can later destroy the  
>zone and make everything go away.  I'm having a problem because the nib  
>file contains Windows, and the program has a segmentation fault shortly  
>after the zone is destroyed.
>
>I remember glancing at an article in the spring NeXTworld magazine which  
>discussed how to deal with freeing zones which contain Windows, but I  
>don't have access to that particular issue anymore.
>
>Could someone give me a quick summary on the steps necessary?

Make sure you orderOut and free all of the windows in the zone before
destroying it or things will die.  


andrew
-- 
andrew@cubetech.com
Andrew Loewenstern      | "If I am not for myself, who will be for me?
Cube Technologies, Inc. |  If I am only for myself, who am I?" -Hillel
Re: Destroying Zones
#350
Author: simsong Simson L. Garfinkel
Date: Thu, 30 Jul 1992 11:28
16 lines
1332 bytes
In article <1992Jul27.010436.1749@kakwa.ucs.ualberta.ca>  
gary@niagara.ucs.ualberta.ca (Gary Ritchie) writes:
> I'm loading a nib file into its own zone, so that I can later destroy the  
> zone and make everything go away.  I'm having a problem because the nib  
> file contains Windows, and the program has a segmentation fault shortly  
> after the zone is destroyed.
> 
> I remember glancing at an article in the spring NeXTworld magazine which  
> discussed how to deal with freeing zones which contain Windows, but I  
> don't have access to that particular issue anymore.

You must take the windows off the window list before you destroy them.  You can  
do this by accessing the window list directly....
-- 

................................................................simson
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads