Releases and component handles
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Releases and component handles
When you release a COM object, this invalidates every
component handle that references the same object. Any further attempt
to use an invalidated component handle results in an error indicating
that an invalid action was performed on an invalid COM-HANDLE value.
On the other hand, if you instantiate a different COM object after releasing the first one, a previously invalidated component handle might point to the new COM object. The component handle might be reused because the object server might reuse memory left over from the released COM object. In this case, the component handle might be seen as valid. However, the object that the component handle references is different, so this might result in errors or successful method calls with results that are invalid for your application.
In general, to avoid errors and confusion with invalidated COM handles, it is a good practice
to set any COM-HANDLE variables to the Unknown value (?)
once you have released it.