Ignore:
Timestamp:
Jun 30, 2023, 3:36:57 PM (11 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/overos/UWindow.pas

    r24 r38  
    11unit UWindow;
    22
    3 {$mode delphi}{$H+}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, UTypes, UMouse, UControls, UGraphics;
     6  Classes, SysUtils, Generics.Collections, UTypes, UMouse, UControls, UGraphics;
    97
    108type
     
    9694  public
    9795    Canvas: TCanvas;
    98     Windows: TFPGObjectList<TWindow>;
     96    Windows: TObjectList<TWindow>;
    9997    Size: TSize;
    10098    procedure Paint;
     
    116114begin
    117115  if FWindow = AValue then Exit;
    118   Canvas.Free;
     116  FreeAndNil(Canvas);
    119117  FWindow := AValue;
    120118  Canvas := TCanvasWindow.Create;
     
    173171destructor TTitleBar.Destroy;
    174172begin
    175   ButtonClose.Free;
    176   ButtonMaximize.Free;
    177   ButtonMinimize.Free;
     173  FreeAndNil(ButtonClose);
     174  FreeAndNil(ButtonMaximize);
     175  FreeAndNil(ButtonMinimize);
    178176  inherited;
    179177end;
     
    293291begin
    294292  inherited;
    295   Canvas.Free;
     293  FreeAndNil(Canvas);
    296294  Canvas := TCanvasWindow.Create;
    297295  TCanvasWindow(Canvas).Window := Self;
     
    304302begin
    305303  Visible := False;
    306   TitleBar.Free;
     304  FreeAndNil(TitleBar);
    307305  Screen := nil;
    308   inherited Destroy;
     306  inherited;
    309307end;
    310308
     
    448446constructor TScreen.Create;
    449447begin
    450   Windows := TFPGObjectList<TWindow>.Create;
    451   Windows.FreeObjects := False;
     448  Windows := TObjectList<TWindow>.Create;
     449  Windows.OwnsObjects := False;
    452450  Canvas := TCanvas.Create;
    453451end;
     
    459457  for I := Windows.Count - 1 downto 0 do
    460458    Windows[I].Free;
    461   Windows.Free;
    462   Canvas.Free;
    463   inherited Destroy;
     459  FreeAndNil(Windows);
     460  FreeAndNil(Canvas);
     461  inherited;
    464462end;
    465463
Note: See TracChangeset for help on using the changeset viewer.