Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Registry / INI Objects    [ Add a report in this area ]  
Report #:  103542   Status: Resolved
[MacOS] TIniFile fails with read-only files
Project:  Delphi Build #:  16.0.4316.44803
Version:    16.2 Submitted By:   Sebastian Modersohn
Report Type:  Minor failure / Design problem Date Reported:  2/20/2012 5:14:53 AM
Severity:    Infrequently encountered problem Last Updated: 11/30/2015 10:07:41 AM
Platform:    All Mac platforms Internal Tracking #:   290031
Resolution: Fixed (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: 20
Description
When destroying a TIniFile object of a read-only .ini-file an exception will be raised on non-windows platforms.

The reason is that on non-windows platforms the UpdateFile method is called in the destructor whereas on Windows only an API to flush the INI cache is called.
Steps to Reproduce:
1. Create a basic FireMonkey application on a Mac
2. Put a locked ini-file in your home directory
3. Add an event handler similar to this

procedure TfrmTestMain.FormCreate(Sender: TObject);
var
  inifile: TInifile;
begin
  iniFile:= TIniFile.Create(<path to ini file>);
  try

  finally
    iniFile.Free;
  end;
end;

4. Run the app

exp: app should work fine
act: SIGSEGV (11) is raised

5. Remove the lock of the file and the app will run just fine.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01