[comp.sys.mac.programmer] DisposeMenu vs. ReleaseResource

barry@world.std.com (Barry L Wolman) (05/01/91)

I'm incorporating some code written by someone else into a project I'm
doing.  That code assumes that it can use DisposeMenu when it's through
with a menu.  However, many of the menus with which it will deal will
have been read from the resource file.  Inside Mac says to use
ReleaseResource to get rid of menus read from resource files and to
use DisposeMenu for menus created by NewMenu.  IM doesn't say what
happens if you call DisposeMenu on a menu read from a resource file.
Should I add some code to check what type of menu is involved and
make the appropriate call?  What (bad?) happens if I just let it
always call DisposeMenu.

Thanks,
Barry

-- 
Barry Wolman
159 Oxbow Road
Needham, MA 02192
617-449-3874

nerm@Apple.COM (Dean Yu) (05/02/91)

In article <1991May1.005649.27669@world.std.com> barry@world.std.com (Barry L Wolman) writes:
>I'm incorporating some code written by someone else into a project I'm
>doing.  That code assumes that it can use DisposeMenu when it's through
>with a menu.  However, many of the menus with which it will deal will
>have been read from the resource file.  Inside Mac says to use
>ReleaseResource to get rid of menus read from resource files and to
>use DisposeMenu for menus created by NewMenu.  IM doesn't say what
>happens if you call DisposeMenu on a menu read from a resource file.
>Should I add some code to check what type of menu is involved and
>make the appropriate call?  What (bad?) happens if I just let it
>always call DisposeMenu.
>

  _DisposeMenu does the right thing, so it's ok to always call it to get rid
of a menu.  Looking at the dates in the source, it's been like this since the
128K ROMs.  And I know that we touched it up a bit for System 7.

  -- Dean Yu
     Blue Meanie, Negative Ethnic Role Model, etc.
     Apple Computer, Inc.
     My opinions and so on and so forth...