diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-10-04 17:29:18 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-10-04 17:29:18 +0200 |
| commit | 47208d263f3940ec65e7f94b9cc8f4c588234ac5 (patch) | |
| tree | f7b3bb5a5bfa655d0568a44e6fbdf17f08ce106c /UMain.pas | |
| parent | 9edcc05f98afb705071e9a906492aaf4d3a10160 (diff) | |
| download | tuxcmd-47208d263f3940ec65e7f94b9cc8f4c588234ac5.tar.xz | |
Always check GetFileInfoSL() result
This prevents crashes when file was deleted and included in selection for some operation.
Also fix minor memory leaks...
Diffstat (limited to 'UMain.pas')
| -rw-r--r-- | UMain.pas | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -3607,8 +3607,11 @@ begin Stat := Engine.GetFileInfoSL(Filename); if Assigned(Stat) and (Stat^.Size > ConfEditViewFileSizeLimit) and (Application.MessageBox(LANGTheFileYouAreTryingToOpenIsQuiteBig, [mbYes, mbNo], mbWarning, mbNone, mbNo) = mbNo) - then Exit; - + then begin + FreeDataItem(Stat); + Exit; + end; + FreeDataItem(Stat); if View then s := ConfViewer else s := ConfEditor; @@ -3713,6 +3716,7 @@ begin b := ExecuteProgram(QuoteStr(Path), ExtractFilePath(Path), AutodetectGUI, RunInTerminal, i); libc_chdir(PChar('/')); end else b := True; // Mask cancelled extraction from VFS + FreeDataItem(Stat); end else begin if Engine is TVFSEngine then begin HandleRunFromArchive(Path, Engine, Command, FileTypeDesc, False); @@ -4115,6 +4119,7 @@ begin DoRefresh(not LeftPanel, True, True); end; finally + FreeDataItem(Stat); FChmod.Free; end; finally @@ -4207,6 +4212,7 @@ begin DoRefresh(not LeftPanel, True, True); end; finally + FreeDataItem(Stat); FChown.Free; end; finally @@ -4460,6 +4466,8 @@ begin Item.Visible := False; // Item.Enabled := not UpDir; FilePopupMenu.Add(Item); + + FreeDataItem(DataItem); end; procedure TFMain.FilePopupMenuItemClick(Sender: TObject); @@ -4524,6 +4532,7 @@ begin if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [FileName]), [mbOK], mbError, mbNone, mbOK); end; end; + FreeDataItem(DataItem); finally Application.ProcessMessages; InternalUnLock; @@ -6391,6 +6400,7 @@ begin DoRefresh(not LeftPanel, True, True); end; finally + FreeDataItem(Stat); FProperties.Free; end; finally @@ -6501,6 +6511,7 @@ begin if Command = '' then Command := LANGHandleRunFromArchive_SelfExecutable; FRunFromVFS.OpensWithLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', [Command]); end; + FreeDataItem(Stat); end else begin FRunFromVFS.SizeLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', ['??']); FRunFromVFS.PackedSizeLabel2.Caption := Format('%s<span weight="ultrabold"> </span>', ['??']); @@ -6514,8 +6525,6 @@ begin FRunFromVFS.DateLabel2.UseMarkup := True; FRunFromVFS.OpensWithLabel2.UseMarkup := True; - FreeDataItem(Stat); - Res := FRunFromVFS.Run; FRunFromVFS.Close; FRunFromVFS.Free; |
