I've created a COM object which contains a form of "canvas" for drawing. This component exposes some functions which allow me to manipulate it through pb. I've managed to load the object in a window, by inserting it as an OLE custom Control (Insert > Control > OLE > InsertControl...).
The object seems to work ok, and I can access its methods using controlName.object.method(). So far so good. My problem is when I close the application, it crashes. I thought that I need to destroy the control in the window's close() event. That does not seem to work though. Or calling the controlName.clear() function. Is there a way to release the object's memory and avoid crashing the application?