I have a code pattern that looks like this;
NEW someInfragisticsObject;
someInfragisticsObject:SUBSCRIBE(someEventHandler);
/* Do something */
someInfragisticsObject:UNSUBSCRIBE(someEventHandler);
someInfragisticsObject:Dispose();
DELETE OBJECT someInfragisticsObject.
After running the code block several times, I get an Invalid Handle error. Any ideas?
I've seen similar problems. It looks like the Dispose causes the .net side of the object to be (forced) disposed, but the proxy ABL object on the AVM side isn't always deleted as well...
You *should* never need to write a DELETE OBJECT for a .net object; simply clearing the reference *should* cause the garbage collector to release any resources.
I've written a Disposer class to clean up a Ribbon and all its contained/referenced Infragistics objects, as without it we've had huge memory leaks with Infragistics Ribbons. The Disposer mainly iterates over all RibbonTabs/Groups/Tools and calls Dispose() on them. Afterwards the objects are deleted using DELETE OBJECT, only when the handle is still valid...