View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0031441||Lazarus||IDE||public||2017-02-24 19:03||2019-11-04 18:41|
|Reporter||Andrei Datcu||Assigned To||Juha Manninen|
|Status||resolved||Resolution||no change required|
|Platform||Win32||OS||Windows||OS Version||7 64 bit|
|Product Version||1.6.2||Product Build|
|Target Version||Fixed in Version|
|Summary||0031441: Running program that uses TRegIniFile from Lazarus IDE results in program crashing with SIGSEGV|
|Description||If I have a program/LCL Application that uses TRegIniFile and I run it from the IDE, I always get a fatal exception when running the object's destructor.|
|Steps To Reproduce||Open the attached project in Lazarus 1.6.2. Run the project.|
|Additional Information||Let's take the following snippet|
rf := TRegIniFile.Create('Software\BogusName');
c := rf.ReadInteger('ReadOptions', 'CheckSignature', 0); // Always returns 0
rf.Free; // Always crashes if here if the Reg Key exists. If it doesn't, then there's no crash
|Tags||No tags attached.|
|Fixed in Revision|
162 bug test.zip (1,736 bytes)
||This is a regression, because I cannot reproduce the issue with an older 1.3 trunk build compiled with FPC 2.6.5|
It only crashes in the debugger.
Looks like a gdb issue.
What gdb versions do you have with Laz 1.6 and with Laz 1.3?
||Try to set DisableLoadSymbolsForLibraries to true in IDE Options -> Debugger.|
> Try to set DisableLoadSymbolsForLibraries to true in IDE Options -> Debugger.
Did not help (laz trunk with gdb 7.2)
||If you compile with 2.6.4 it does not crash in gdb (7.2)|
I wanted to add, I just had an issue with the use of TStringList.
The TIniFile.Create uses this to load the list in memory if it exist, and I bet it is failing the same way my attempt of use is.
Tstrings.LoadFromFile uses a TfileStream(name, FmOpenRead or FmShareDenyWrite);
In my case the file I am loading is in the same work folder as the project
and GetLastError reports it as a code 32,"Share violation" and any code after
that expecting valid data will fault or Ship out of block because there is
no exception block to generate a clear error.
To fix my problem I had to create a TfileStream(Name, fmOpenRead, FmShareDenyDone);
And the StringList.LoadeFromStream(This_Stream); Which works..
With the TiniFile.Create, The LoadFromFile is only performed if the FileExist.
||@jamie: I see no relation to this bugreport.|
I am trying to point you in a direction that looks exactly the same issue..
The ini file may already have a handle attached to it that could of been left
in the WRITE&READ mode and then comes along Tinifile again, wanting to load the
file, because now it exist using FileExit function. Tstrings.LoadFromFile sets
it for fmOpen or FmShareDenyWrite; which it may already be in WRITE mode.
This is the problem with my use of the TstrlingList, I had to work around it.
Inifile, has the same loading procedures with no work around in case it fails
due to file permissions.
||Please upload a patch that fixes the problem for you.|
There is no error in the TRegInifile component..
Its misuse of the code..
TregInifile.Create(FileName); needs the whole section string value in there.
rf := TRegIniFile.Create('full section name required');
C := Rf.ReadInteger(Rf.Filename, 'CheckSignature', 0);
---------------------^^^^^^^^^^^---That's the key!
I am sure by now it's been figured out.
as for my issue.,. That too is basically a user issue of having the file
aleady opened elsewhere, file permission issies, which looked a lot like what
this issue was at first.
I can work around my issue, which I have.
I think you can close this issue as pilot error on the TRegIniFile issues.
You can specify full Section name in the ReadInteger call and have it work too.
||I don't know what "pilot error on the TRegIniFile issues" means but I resolve this now as "no change required".|
|2017-02-24 19:03||Andrei Datcu||New Issue|
|2017-02-24 19:03||Andrei Datcu||File Added: 162 bug test.zip|
|2017-02-24 19:09||Andrei Datcu||Note Added: 0098428|
|2017-02-24 19:44||Bart Broersma||Note Added: 0098430|
|2017-02-24 20:39||Ondrej Pokorny||Note Added: 0098432|
|2017-02-24 20:58||Bart Broersma||Note Added: 0098433|
|2017-02-24 21:05||Bart Broersma||Note Added: 0098434|
|2017-02-26 15:56||jamie philbrook||Note Added: 0098473|
|2017-02-26 15:58||jamie philbrook||Note Edited: 0098473||View Revisions|
|2017-02-26 17:07||Bart Broersma||Note Added: 0098475|
|2017-02-26 21:04||jamie philbrook||Note Added: 0098480|
|2017-02-28 12:25||Juha Manninen||Note Added: 0098502|
|2017-03-05 19:58||jamie philbrook||Note Added: 0098668|
|2017-03-05 19:59||jamie philbrook||Note Edited: 0098668||View Revisions|
|2017-03-05 20:18||Juha Manninen||LazTarget||=> -|
|2017-03-05 20:18||Juha Manninen||Note Added: 0098670|
|2017-03-05 20:18||Juha Manninen||Status||new => resolved|
|2017-03-05 20:18||Juha Manninen||Resolution||open => no change required|
|2017-03-05 20:18||Juha Manninen||Assigned To||=> Juha Manninen|