WebContainer.close = destroyed?

Hi all,

For my project, there is a defined ContainerControl say myContainerControl. A Webpage with a property say myLocContainer (of class myContainerControl).

if myLocContainer <> nil then myLocContainer.close
myLocContainer = new myContainerControl
myLocContainer.EmbedWithin(self, …)

In debug mode, myLocContainer is nil only when the program first run. After myLocContainer is created, even after executing myLocContainer.close, object myLocContainer and all its variables are still there, looks like .close never executed. The program still runs normally, but if there is any potential problem (memory leak) if I keep on ‘new’ the container? Or do I have to set myLocContainer = nil?

Thanks.

Try adding a CloseMe method to the Container, where that method has one line:

Self.Close

Then call that method to close the Container.

Close executes close on all the controls. It does not completely destroy them. It does not destroy any properties, it does not destroy the container. As long as you have a reference to the container, the controls and properties will be intact, although the controls are no longer usable. Once you release the reference, then everything gets cleaned up.