Ignore:
Timestamp:
Jun 26, 2020, 1:13:34 AM (4 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r265 r266  
    812812    FMainForm: TDpiForm;
    813813    FCreatingForm: TDpiForm;
     814    FOldExitProc: Pointer;
    814815    function GetActive: Boolean;
    815816    function GetShowMainForm: Boolean;
     
    821822  protected
    822823    function GetNativeApplication: TApplication; virtual;
     824    procedure DoBeforeFinalization;
    823825  public
    824826    constructor Create(AOwner: TComponent); override;
     
    15941596end;
    15951597
     1598procedure DpiBeforeFinalization;
     1599// This is our ExitProc handler.
     1600begin
     1601  DpiApplication.DoBeforeFinalization;
     1602end;
     1603
     1604procedure TDpiApplication.DoBeforeFinalization;
     1605var
     1606  i: Integer;
     1607  C: TComponent;
     1608begin
     1609  if Self = nil then Exit;
     1610  for i := ComponentCount - 1 downto 0 do begin
     1611    if i < ComponentCount then begin
     1612      C := Components[i];
     1613      // C.Name
     1614      C.Free;
     1615    end;
     1616  end;
     1617end;
     1618
    15961619function DpiFindApplicationComponent(const ComponentName: string): TComponent;
    15971620// Note: this function is used by TReader to auto rename forms to unique names.
     
    16031626begin
    16041627  RegisterFindGlobalComponentProc(@DpiFindApplicationComponent);
     1628  FOldExitProc := ExitProc;
     1629  ExitProc := @DpiBeforeFinalization;
    16051630  inherited;
    16061631end;
     
    16081633destructor TDpiApplication.Destroy;
    16091634begin
     1635  ExitProc := FOldExitProc;
    16101636  inherited Destroy;
    16111637end;
     
    37363762destructor TDpiForm.Destroy;
    37373763begin
     3764  // Name
    37383765  // TODO: Can't destroy directly?
    37393766  //FreeAndNil(NativeForm);
     3767
     3768  TFormEx(NativeForm).OnMessage := nil;
    37403769  DpiScreen.RemoveForm(Self);
    37413770end;
Note: See TracChangeset for help on using the changeset viewer.