Cannot Close Application

Hi,

dephi 10.4.1
Hydra RemObjects Hydra - 6.6.0.1309
DA RemObjects Data Abstract for Delphi, Server Edition - 10.0.0.1559

Host is VCL, Plugin: fmxVisual PLugin(only some image and Tpath drawing).

If I dont know load the plugin I can close the applcation.

Once I load the Plugin, when at the main form , I run close: even I release the instance and Unload the dll.

I also cant close and in debug no any error.

please advise how to check the error.

Best Regards,
Joe Hon

Hi,

Can you create a simple testcase that reproduces this issue, pls?
you can drop it to support@ for keeping privacy.

Can you test FireMonkey Sample , pls?
does it work correctly ?

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 see my attached and the attached.


2023-08-01_12h12_44

Please advise how to solve.

Joe

Hi,

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.

May be I used the BuildPcakages_D27 to install before.

I need use this to build again. Now is solved . Thanks