Thursday, July 12, 2007

QC48959

I've submitted QC report 48959, titled "TCustomProvider destructor does not call UnregisterProvider".

In TCustomProvider.Destroy there's some code which assumes that Owner is still assigned during destruction. This, however, is not the case if the provider is being destroyed implicitly because of ownership.

Typically, you put provider components directly on your remote data module in which case this is not a problem: it's unnecessary to call UnregisterProvider since the remote data module (IAppserver implementor which exposes the providers) itself is being destroyed.

However, if your remote data module is not the same object as the owner of your provider components (the owner only delegates the providers), you might encounter this problem, especially when the owner is released while the remote data module stays alive. In this case, the providers are not unregistered before they are freed and the remote data module keeps references to invalid pointers.