In order to avoid having to use a try/catch block to catch the SEH exception described in the previous question, I need to be able to determine whether the object has been released.
How to determine whether the C object has been released or is still a valid pointer?
I have an answered previous question in which I describe when I try to access It is difficult to catch exceptions when an object has been released by a third-party function. The function sometimes executes and sometimes does not release the object.
In order to avoid having to use a try / catch block to catch the previous problem I need to be able to determine whether the object has been released.
How to determine whether the C object has been released or is still a valid pointer?
If the object is still allocated, it cannot be easily judged by looking at the memory location. There may be some black magic tricks, but a cleaner way is to Build a callback mechanism in the destructor of .