Avoiding Race Conditions

[This is preliminary documentation and subject to change.]

It is important to avoid race conditions where a client tries to talk to an object before it is fully initialized or after it is beginning to close down. Active Accessibility containers should not respond to the WM_GETOBJECT message until fully able to respond to requests from the clients. For example, the system will send EVENT_OBJECT_CREATE on the creation of a new window, but before the WM_CREATE message is sent to the window. Since many applications use WM_CREATE to start their initialization process, it would not be wise for the window to respond to the WM_GETOBJECT message until it has processed the WM_CREATE message. Conversely, clients should be aware that the AccessibleObjectFromWindow, AccessibleObjectFromPoint functions might fail if called in response to an EVENT_OBJECT_CREATE. The recommendation is to watch for SHOW and HIDE events rather than CREATE and DESTROY. Objects should be sure to use SHOW and HIDE to bracket their active lifetime.