| Previous | Next |
| ERROR_LB_WITHOUT_TABSTOPS | ERROR_CHILD_WINDOW_MENU |
ERROR_DESTROY_OBJECT_OF_OTHER_THREAD
The object must be destroyed by its owning thread
GUI objects are often thread-affine. For windows, Microsoft explicitly states that a thread cannot call DestroyWindow to destroy a window created by a different thread. Similar USER object lifetime rules protect state tied to the creator's message queue and desktop interaction.
This status is commonly triggered by centralized cleanup that runs on a worker or shutdown thread while the UI thread created the object. The object may be valid and visible; the defect is who performs destruction.
What to check
- Record the creating thread ID when the object is created.
- Post a shutdown message or marshal a destruction callback to the owner thread.
- Wait for owner-thread cleanup before unloading modules that contain window procedures.
- Avoid a global object registry that destroys GUI handles indiscriminately from one manager thread.
The distinction from ERROR_INVALID_WINDOW_HANDLE matters: ownership can be wrong even when the GUI handle is still valid.
References
Looking for a different code? Search another status or error code.