Even though I am releasing plugin instances via method 3 (below), it seems that the “dispose” of the created plugins does not get called, or at least is only called at some pseudo random time.
From testing of my application, the dispose only definitively gets called when the UnloadModules is called on the ModuleManager.
Testing the mixed mode RemObjects sample shows slightly different behaviour.
When the active plugin is changed via the double click (above) and the current plugin is set to nil, the dispose of the .NET plugin does not directly get called. It appears to be randomly called at some point later, perhaps as the framework is clearing up resources ?
This has come to light when firing events back from a DA server to Hydra clients within a Delphi shell. When the hydra plugin client forms are closed, the events are still finding their way to the closed forms - even though up until that point I had though they had been disposed of with the ModuleManager.ReleaseInstance from Delphi.
Can you confirm :-
1). If this is not the expected behaviour then what can I check / do to ensure that dispose is being triggered when the ReleaseInstance is called from Delphi.
2). If it is the expected behaviour, then what is the suggested way of handling events coming back from a RO/DA server into closed / dead hydra client forms (I’ll work on checking a custom flag set when the plugin is closed and ignoring the events accordingly for now).
Thanks,
Paul.