Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Carbon >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Resource chain corruption when using Navigation Services dialogs and Carbon Events


Q: Why does my resource chain get corrupted when I call any of the Navigation Services dialogs since I started using Carbon Events?

A: If you detect this behavior, then you are most likely running Mac OS 8.5 to Mac OS 9.0.4 and using or handling Carbon Events.

Due to a Navigation Services bug, fixed only in Mac OS 9.2, the resource chain state would be saved before each call to WaitNextEvent and be restored to that state after the event had been handled. Any changes to the resource chain (ie. opening or closing files) would be lost and thus the resource chain would become corrupt.

Prior to the Carbon Events model, it was mostly unlikely that this would ever happen since it could only happen if the developer was modifying the resource chain while in a patch of WaitNextEvent.

Due to the fact that Carbon Events handlers can be executed at any time, including while there is a Navigation dialog open, the probability that this bug would show up is a lot higher.

This bug has been fixed in Mac OS 9.2 (the resource chain state is saved after the call to WaitNextEvent and restored after the event handling thus preserving changes happening at WaitNextEvent time) but cannot, for architectural reasons, be fixed in CarbonLib as well. Thus, developers must, to be safe, avoid opening or closing resource files in Carbon Events handlers while a Navigation dialog is opened, but they still can do so in Navigation event proc callbacks.


[Aug 21 2001]