Changeset 105 for trunk


Ignore:
Timestamp:
Jan 25, 2018, 11:33:52 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Various memory leaks.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Back.pas

    r97 r105  
    3737
    3838procedure TBackground.FormShow(Sender: TObject);
     39var
     40  FileName: string;
    3941begin
    40   Img := nil;
    4142  if FullScreen then begin
    42     if FileExists(HomeDir + 'Graphics' + DirectorySeparator + 'Background.png') then begin
    43       Img := TBitmap.Create;
    44       LoadGraphicFile(img, HomeDir + 'Graphics' + DirectorySeparator + 'Background.png');
     43    if not Assigned(Img) then begin
     44      FileName := HomeDir + 'Graphics' + DirectorySeparator + 'Background.png';
     45      if FileExists(FileName) then begin
     46        Img := TBitmap.Create;
     47        LoadGraphicFile(img, FileName);
     48      end;
    4549    end;
    4650  end else begin
  • trunk/Directories.pas

    r79 r105  
    2727begin
    2828  result := FindFirst(path, faDirectory, f) = 0;
     29  FindClose(f);
    2930end;
    3031
     
    9495        CopyFile(PChar(HomeDir + 'AppData' + DirectorySeparator + 'Saved' + DirectorySeparator + src.Name),
    9596          PChar(DataDir + 'Saved' + DirectorySeparator + src.Name), false);
     97      FindClose(dst);
    9698    until FindNext(src) <> 0;
     99  FindClose(src);
    97100end;
    98101
     
    101104InitUnit;
    102105
     106
    103107end.
  • trunk/GameServer.pas

    r54 r105  
    273273        inc(nBrain);
    274274    until FindNext(f) <> 0;
     275  FindClose(F);
    275276end;
    276277
     
    44994500
    45004501FindFirst(ParamStr(0), $21, ExeInfo);
     4502FindClose(ExeInfo);
    45014503
    45024504{$IFOPT O-}nHandoverStack := 0; {$ENDIF}
  • trunk/Start.pas

    r104 r105  
    265265    r1 := CreateRectRgn(TabOffset + 4 * TabSize + 2, 0, Width, TabHeight);
    266266    CombineRgn(r0, r0, r1, RGN_DIFF);
    267     // DeleteObject(r1);
     267    DeleteObject(r1);
    268268    r1 := CreateRectRgn(QuitBtn.left, QuitBtn.top, QuitBtn.left + QuitBtn.width,
    269269      QuitBtn.top + QuitBtn.height);
    270270    CombineRgn(r0, r0, r1, RGN_OR);
    271     // DeleteObject(r1);
     271    DeleteObject(r1);
    272272    SetWindowRgn(Handle, r0, false);
    273     // DeleteObject(r0); // causes crash with Windows 95
     273    DeleteObject(r0); // causes crash with Windows 95
    274274  end
    275275  else
     
    13431343        TObject(f.Time));
    13441344    until FindNext(f) <> 0;
     1345  FindClose(f);
    13451346  ListIndex[2] := FormerGames.Count - 1;
    13461347  if (ShowTab = 2) and (FormerGames.Count > 0) then
     
    13581359      Maps.Add(Copy(f.Name, 1, Length(f.Name) - 9));
    13591360    until FindNext(f) <> 0;
     1361  FindClose(F);
    13601362  Maps.Sort;
    13611363  Maps.Insert(0, Phrases.Lookup('RANMAP'));
  • trunk/Switches.inc

    r39 r105  
    55{$LONGSTRINGS ON}
    66
    7 {$IOCHECKS ON}
    8 {$OVERFLOWCHECKS OFF}
     7//{$IOCHECKS ON}
     8//{$OVERFLOWCHECKS OFF}
    99
    10 {$TYPEINFO OFF}
    11 {$DEBUGINFO ON}
     10//{$TYPEINFO OFF}
     11//{$DEBUGINFO ON}
    1212//{$LOCALSYMBOLS ON}
    1313
    1414//{$E-}
    15 {$S-}
     15//{$S-}
    1616{$Z1}
    1717
    1818{$IFDEF FPC} // freepascal
    1919  {$MODE DELPHI}
    20   {$SMARTLINK ON}
     20  //{$SMARTLINK ON}
    2121{$ELSE} // delphi
    2222  {$APPTYPE GUI}
Note: See TracChangeset for help on using the changeset viewer.