by Maf Vosburgh
updated October 9, 1998
Price Info
WDEF Leopard is free.
Share and enjoy.
Legal Info
This software is supplied "As Is" without warranty of any kind, and
the author does not accept responsibility for any damage it might
accidentally cause.
Info for Normal People
There was a lot of panic last year about the "WDEF crash" :
system error 87.
I wrote this control panel to prevent the problem from happening.
Just drag it to your Control Panels folder and restart. The default
options should work fine.
It installs a friendly "WDEF Leopard" who will try to guard your
system from harm with her powerful paws.
All systems up to MacOS 8.1 have the WDEF bug.
The bug is fixed in MacOS 8.5 so you don't need the Leopard on 8.5
and up.
Way to go Apple!
Info for Geeks
Because of a design limitation in the Window Manager, WDEF resources
cannot safely be marked purgeable.
Because at one time, very few people know this fact, purgeable WDEFs
are quite common. After the WDEF panic a couple of years ago, Apple
sensibly wrote a new
tech note so programmers would stop making this mistake.
Here is why WDEFs should not be marked as purgeable- if the custom
WDEF for a window gets purged, and the Window Manager tries to redraw
that window while the app is in the background, it fails to reload
the WDEF code, because it calls LoadResource with the wrong current
resource file.
The Window Manager engineers could fix this by -
a) inserting one line of code (a call to HNoPurge) in their code that
loads custom WDEFs,
or
b) inserting a few lines of code around their call to LoadResource so
they use the right resource file
However, Apple seemed unwilling to fix the Window Manager at the
time, so I wrote this control panel, which fixes the problem by
briefly taking control whenever an application is launched and
marking the resources in question non-purgeable. It does not save
these changes to disk, so it shouldn't cause problems with updaters,
virus checkers, backup programs etc.
Other resource types
Once I had the code working, I got a bit carried away and added
protection for other resource types. By default this is turned
off.
Like WDEF resources, MENU resources should not be purgeable. However this is such a rare programming mistake for someone to make that the check is probably unnecessary. Enable this only if you get system error 84 on a regular basis.
CDEF and MDEF resources probably don't need protection, as the
operating system is supposed to be able to reload these as
needed..
Enable CDEF protection only if you have problems with system error
88.
Enable MDEF protection only if you have problems with system error
89.
Revision History
Version 1.0
First release.
Version 1.1
I added MDEF, CDEF and MENU resources to the list of types to preload
and make unpurgeable.
This has improved the robustness of certain programs considerably
when put to the standard test - switch to ZoneRanger, purge the heap
of the target app, then make it redraw while in the background.
Version 1.2
Made it into a Control Panel, so users can choose which resources are
preloaded.
Removed the option to preload MENUs, as this crashes ClarisWorks
4.0.
Version 1.2.1
In line with various suggestions made by Robert Thornton, I changed
the strategy of the code - it now no longer preloads resources, just
marks them non-purgeable in the resource map. This is faster, uses
less memory, and also fixes the previous MENU conflict with
ClarisWorks. That has enabled me to reinstate the MENU protection
feature (which protects you from system error 84). The patch on
_InitGraf is now a proper head-patch (don't worry if you don't know
what that means).
Version 1.2.2
Made a small change to make the Leopard compatible with old black and
white machines with a 68000 processor. People with other Macs may as
well stick with 1.2.1.
Version 1.2.3
Changed the control panel to make the user interface clearer.
The WDEF protection is essential, but the other options are rarely
needed. There is now a "Use Defaults" button that turns WDEF
protection on, and turns the other options off.
Added balloon help to state which options tackle which system
errors.
Thanks to
Robert Thornton for key information.
Graham Bartram for the name.
Dan Salmon for being the first tester.
Binky and Kevin for being cool.
Vik Rubenfeld for pointing the problem out on Usenet.
Tracy Valleu, Troy Gaul, Robert Thornton and Ric Ford for other
info.