When I remove resource file project, the softeware was
crashed.
This is the sequence.
The following error occured in version 4.9.9.0:
Access violation at address 00000000. Read of address
00000000 (at address 0x00000000)
Please include a description of what you were doing
before the error occured (please give as much precisions
as possible) :
State information follows:
Stack trace:
005805DD (0017F5DD): ShowExceptionInfo
(ExceptionsAnalyzer - 557)
005807D3 (0017F7D3):
TExceptionsAnalyzer.GlobalExceptionHandler
(ExceptionsAnalyzer - 565)
0057005C (0016F05C): TMainForm.LoadText (main -
1607)
00554ECB (00153ECB): TProjUnit.Destroy (project - 238)
0055CAC3 (0015BAC3): TUnitList.Remove (project -
2043)
0055A424 (00159424): TProject.Remove (project - 1315)
00575550 (00174550):
TMainForm.actUnitRemoveExecute (main - 3239)
00581D82 (00180D82): (devcpp - 196)
00581DA0 (00180DA0): (devcpp - 196)
00581844 (00180844): (devcpp - 116)
Logged In: YES
user_id=301445
To figure out this problem, i think the following 3 lines from
line 2194 should me comment.
main.pas : line 2870
if InProject and Assigned(fProject) then begin
res:=fProject.FolderNodeFromName('Resources');
NewUnit := fProject.AddUnit(fname, res, True);
NewUnit.Editor := NewEditor;
end;
====
line 2194
if not e.InProject then
begin
dmMain.AddtoHistory(e.FileName);
FreeAndNil(e);
end
else
begin
// if e.IsRes or (not Assigned(fProject)) then
// FreeAndNil(e)
// else
if assigned(fProject) then
fProject.CloseUnit(fProject.Units.Indexof(e));
end;
===
When I followed creating steps between source files and
resource files, both were handled differently. I don't know
why this should handle differently.
However, the crash of this bug happended at line 2196
because the resouce file is in the project file and it tried to
destroy object from reference pointer.
From the first condition, "if not e.InProject then", it filtered
whether current file is in project or not. So, no matter what a
source is header file, cpp file, or resource file will be released
object from this condition.
The other condition, "else", means that the file is in TProject
object. It MUST RELEASE member variable, "fEditor", from
inside of object. But, in case of resource file, it tried to
release the object from outside with only reference value.
====
No exception for resource file. In case of resource file, all unit
will be released from here.
"if e.IsRes or (not Assigned(fProject)) then FreeAndNil(e)".
This is why the crash happened.
===
My fundamental question is why resouce file and unit files
should be handle differently instead of going through the sam
e procedure for creating new unit and setting some values for
resource file.
Logged In: YES
user_id=229923
Specu, you should be able to handle this one no prob!
Kip
Logged In: YES
user_id=609236
fixed in cvs, please let me know:
http://www.castlesofpoland.com/dev-cpp/devcpp.exe