Suppose I have a drawing stack that is called from a view's drawRect: method. This stack can end up quite deep, with objects calling other objects to implement parts of their drawing. Some of these methods will save and restore the graphics context.

If an exception is thrown from somewhere down inside this stack, I'd prefer it if I could continue to draw what can be drawn, rather than have to abort the drawing altogether which usually leaves the whole view in a weird state (at which point I'm hosed - I have to abandon that document and create a new one, which is hardly user friendly).

Short of using try/catch around every place where the graphics context is saved and restored, is there a way to unwind the graphics context stack or at least put it into a good known state? (i.e. discard all the saved states and start over). If so, I can then implement a try/ catch at a higher level and fix up the graphics context there.

Anyone had some experience of handling this?

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to