How do I determine if I have canceled C objects?

I have an answered previous question in which I described the difficulty of catching exceptions when I try to access an object that has been released by a third-party function. The function sometimes executes and sometimes does not The object will be released.

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?

If the object is still allocated, it cannot be easily judged by looking at the memory location. There may be some Black magic trick, but a cleaner way is to build a callback mechanism in the object’s destructor.

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 .

Leave a Comment

Your email address will not be published.