[comp.sys.next] Be careful!

rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (07/14/89)

I spent a lot of hours tracking this down, so in the interests of
saving other people time---

Be *very* careful using save/restore in DPS.  My specific example
was to do a save/restore around a particularly complex operation.
Inside that operation if an error occurred I would call NXAlert()
(or NXRunAlertPanel()).  The first time the alert went up,
everything was fine.  Then I repeated my complex operation, and
got another error---this NXAlert() didn't work so well.

(To clarify:  save/NXAlert/restore/save/NXAlert/restore is the
sequence that breaks things.)

This sort of makes sense; the first NXAlert sets things up for any
subsequent NXAlerts---and if you restore out from under the first
one, of course you'll get problems.  In summary, programming DPS
is *not* the same as programming PostScript as far as save/restore
is concerned.

Solution?  Use a different PS context for your own rendering and
don't call Appkit stuff in that context, or simply be very careful
about what operations you allow inside of a save/restore pair.

-tom "just trying to get some useful information into this group,
      which to date has been a pretty dull party, like those ones
      you go to at some major academic conferences with the nerds
      who neither know how to dance nor how to drink, so they sit
      around and blab about computers while the *wonderful* dance
      music wastes itself bouncing against the walls, but I don't
      suppose anyone reading this group knows what I mean . . .