View Issue Details

IDProjectCategoryView StatusLast Update
0038377LazarusOtherpublic2021-01-21 17:09
ReporterUwe Schächterle Assigned ToJuha Manninen  
Status resolvedResolutionfixed 
Product Version2.0.10 
Summary0038377: Lazbuild Crashes during Building (patch in uploaded files)
DescriptionThis Issue is related to issue: 0038376

When compiling a project lazbuild gets a access violation

in this line
    if not LazarusIDE.IDEStarted then

due to a missing nil pointer check.

I attached a patch to fix this
TagsNo tags attached.
Fixed in Revisionr64409
Attached Files


Uwe Schächterle

2021-01-20 12:46


projpackcommon.pas.patch (596 bytes)   
Index: projpackcommon.pas
--- projpackcommon.pas	(Revision 64405)
+++ projpackcommon.pas	(Arbeitskopie)
@@ -148,7 +148,7 @@
   if FUpdateLock=0 then RaiseGDBException('TProjPackDefineTemplates.EndUpdate');
   if FUpdateLock=0 then begin
-    if not LazarusIDE.IDEStarted then
+    if (not assigned(LazarusIDE)) or (not LazarusIDE.IDEStarted) then
       Include(FFlags, ptfLoading);
     if FFlags * [ptfIsPackageTemplate,ptfIDChanged]  // AND
               = [ptfIsPackageTemplate,ptfIDChanged] then
projpackcommon.pas.patch (596 bytes)   

Juha Manninen

2021-01-20 14:11

developer   ~0128448

Please test with r64409. I changed the line to:
  if Assigned(LazarusIDE) and not LazarusIDE.IDEStarted then
Product Version in your report says "2.0.10" but I guess you have trunk 2.1, the development version.

And yes damn, I forgot to test LazBuild properly again.

Uwe Schächterle

2021-01-21 06:46

reporter   ~0128458

Your Suggestion works for me as well.

My interpretation of this line of code was, that if the IDE is not running the flag needed to be set, so if the Pointer is invalid my thought was that then the ide is also not running therefore i modeled it with the or.

But to be honest i don't really understand what the code there is doing, i only figured out, what to do, to not get a Access Violation ;)

Juha Manninen

2021-01-21 17:08

developer   ~0128466

Last edited: 2021-01-21 17:09

View 2 revisions

"not LazarusIDE.IDEStarted" means IDE is running but still loading initial info.
LazBuild should not logically need to check such things because it has no IDE.
In fact I added this yet another IdeIntf dependency for LazBuild during my recent optimizations. I will clean it with other refactoring later.

Issue History

Date Modified Username Field Change
2021-01-20 12:46 Uwe Schächterle New Issue
2021-01-20 12:46 Uwe Schächterle File Added: projpackcommon.pas.patch
2021-01-20 13:54 Juha Manninen Assigned To => Juha Manninen
2021-01-20 13:54 Juha Manninen Status new => assigned
2021-01-20 14:04 Juha Manninen Relationship added related to 0038376
2021-01-20 14:11 Juha Manninen Status assigned => feedback
2021-01-20 14:11 Juha Manninen LazTarget => -
2021-01-20 14:11 Juha Manninen Note Added: 0128448
2021-01-20 14:22 Juha Manninen Relationship deleted related to 0038376
2021-01-21 06:46 Uwe Schächterle Note Added: 0128458
2021-01-21 06:46 Uwe Schächterle Status feedback => assigned
2021-01-21 17:08 Juha Manninen Status assigned => resolved
2021-01-21 17:08 Juha Manninen Resolution open => fixed
2021-01-21 17:08 Juha Manninen Fixed in Revision => r64409
2021-01-21 17:08 Juha Manninen Note Added: 0128466
2021-01-21 17:09 Juha Manninen Note Edited: 0128466 View Revisions