Hi,
after the source tracing, the problem is on ModuleManager.UnloadModules;.
when calling the unloadModules, it hangs.
This is the ModuleManager.
object ModuleManager: THYModuleManager
EnforceSecurity = False
AutoLoad = False
ResolveInterfacesToOwner = True
Left = 152
Top = 96
end
I only load one dll by ModuleManager.LoadModules(‘Plgn.dll’);
This is calling Unload.
procedure ThostDataModule.ReleaseNow;
begin
ModuleManager.ReleaseInstance(Instance);
ModuleManager.UnloadModules;
end;
The exactly line problem is on
procedure THYModuleManager.UnloadModule(aModule: THYBaseModule);
var
filename: string;
i, idx: Integer;
controller: THYVCLModuleController;
lModule: THYModule;
l_hostaware: IHYVCLHostAware;
begin
if aModule = nil then Exit;
lModule := THYModule(aModule);
filename := lModule.FileName;
controller := lModule.ModuleController;
if Assigned(fOnBeforeUnloadModule) then fOnBeforeUnloadModule(Self, lModule);
// Adds the references to the factories of this module
for i := 0 to controller.FactoryCount-1 do begin
idx := fFactoriesRefs.IndexOf(controller.Factories[i]);
if (idx>=0) then fFactoriesRefs.Delete(idx);
end;
if CanUnload(lModule, true) then begin
if Supports(lModule.ModuleController, IHYVCLHostAware, l_hostaware) then begin
l_hostaware.Host := nil;
l_hostaware := nil;
end;
fModules.Remove(aModule);<<< this line hang response.
end;
if Assigned(fOnAfterUnloadModule) then fOnAfterUnloadModule(Self, filename);
end;
You can’t correctly unload visual FMX plugin because the External exception 87A exception is raised in dxgi.dll when fmx.FMX.Forms.FinalizeForms is called.
Add {$I Hydra.inc} to Hydra.VCL.FireMonkeyModule.pas:
unit Hydra.VCL.FireMonkeyModule;
{$I Hydra.inc} //<<<< added
interface
close Delphi and call C:\Program Files (x86)\RemObjects Software\Build\install_HY.cmd with admin rights.
it should solve issue with closing VCL host when visual FMX plugin is used.