View Issue Details

IDProjectCategoryView StatusLast Update
0035059LazarusIDEpublic2019-02-18 13:08
ReportererrnoAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformPCOSwindows 64 bitsOS Version7
Product Version2.1 (SVN)Product Build60400 
Target VersionFixed in Version 
Summary0035059: Under certain circumstances, projects options are not applied
Descriptionmodifications of the "Compiler command" in project otptions are sometimes not applied .
Steps To Reproduce1)open provided project test.lpi in testProj.zip
2)open the project options dialog ,
  in <Compiler Commands>\<execute before> change "hello" to "hello1" , close with ok button
3)compile -->you get "hello1 + test" in the message dialog (Ok)
4)reopen the project options dialog ,
  in <Compiler Commands>\<execute before> change "hello1" to "hello" , close with ok button
5)compile -->you should now have "hello + test" in the message dialog , but you still have "hello1 + test" (bug)
6)compile again and again , you still have "hello1 + test" (bug)
Additional Informationpatch added
TagsNo tags attached.
Fixed in Revisionr60444
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • testProj.zip (3,171 bytes)
  • CompilerOptions.patch (450 bytes)
    Index: ide/compileroptions.pp
    ===================================================================
    --- ide/compileroptions.pp	(r�vision 60400)
    +++ ide/compileroptions.pp	(copie de travail)
    @@ -4235,7 +4235,7 @@
     procedure TCompilationToolOptions.SetCommand(AValue: string);
     begin
       inherited SetCommand(AValue);
    -  Inc(FParsedCommandStamp);
    +  FParsedCommandStamp:=0;
     end;
     
     procedure TCompilationToolOptions.SubstituteMacros(var s: string);
    
    CompilerOptions.patch (450 bytes)

Relationships

related to 0034283 resolvedJuha Manninen Patches ExecuteCommand is missing in compoptsintf.pas 

Activities

errno

2019-02-10 18:00

reporter  

testProj.zip (3,171 bytes)

errno

2019-02-10 18:00

reporter  

CompilerOptions.patch (450 bytes)
Index: ide/compileroptions.pp
===================================================================
--- ide/compileroptions.pp	(r�vision 60400)
+++ ide/compileroptions.pp	(copie de travail)
@@ -4235,7 +4235,7 @@
 procedure TCompilationToolOptions.SetCommand(AValue: string);
 begin
   inherited SetCommand(AValue);
-  Inc(FParsedCommandStamp);
+  FParsedCommandStamp:=0;
 end;
 
 procedure TCompilationToolOptions.SubstituteMacros(var s: string);
CompilerOptions.patch (450 bytes)

errno

2019-02-10 19:02

reporter   ~0114018

Last edited: 2019-02-10 22:15

View 3 revisions

Append also in lazarus 2.0 , CompilerOptions.patch should fix also lazarus 2.0


errata : in the title you should read "circumstances" in place of "circonstances" .

Bart Broersma

2019-02-11 00:16

developer   ~0114022

Fixed the typo in the summary.

errno

2019-02-16 12:20

reporter   ~0114177

Last edited: 2019-02-16 12:22

View 2 revisions

I suppose this bug happens in every OS/widgetset .
imao this patch is right .

FParsedCommandStamp is a variable that avoids too often parsing the command line at every compilation. It must be reset to 0 (and not incremented) in TCompilationToolOptions.SetCommand because when this function is called the command is not parsed.

Can a devel have a look please ?

Juha Manninen

2019-02-17 14:58

developer   ~0114220

Last edited: 2019-02-17 17:57

View 2 revisions

> ... because when this function is called the command is not parsed.

Isn't it parsed the next time when it is needed?
Incrementing the stamp should make sure it happens.
I will test with your example ...

errno

2019-02-17 23:24

reporter   ~0114233

Last edited: 2019-02-18 00:46

View 5 revisions

>Incrementing the stamp should make sure it happens.
The way it is coded, no.
"FParsedCommandStamp" is synchronized with the global variable "CompilerParseStamp" in TCompilationToolOptions.GetParsedCommand when the macros of the command are resolved. And this happens if FParsedCommandStamp<> CompilerParseStamp. If you increment FParsedCommandStamp somewhere (as in TCompilationToolOptions.SetCommand), "FParsedCommandStamp" may in some cases be equal to "CompilerParseStamp", which prevents the command line from being parsed.
Only "CompilerParseStamp" should be incremented.

>Isn't it parsed the next time when it is needed?
If you strictly follow the steps to reproduce the bug , no it isn't .
But if you do more manipulations in the IDE (like opening the IDE option dialog) , the "CompilerParseStamp" may be incremented , this causes FParsedCommandStamp<>CompilerParseStamp , this causes the command line to be parsed again .

Juha Manninen

2019-02-18 09:24

developer   ~0114236

Yes you are right.
Other similar stamp values are reset to CTInvalidChangeStamp, thus I used it also for FParsedCommandStamp.

errno

2019-02-18 13:08

reporter   ~0114238

>Other similar stamp values are reset to CTInvalidChangeStamp
Yes right .

Good Thanks .

Issue History

Date Modified Username Field Change
2019-02-10 18:00 errno New Issue
2019-02-10 18:00 errno File Added: testProj.zip
2019-02-10 18:00 errno File Added: CompilerOptions.patch
2019-02-10 19:02 errno Note Added: 0114018
2019-02-10 19:03 errno Note Edited: 0114018 View Revisions
2019-02-10 22:15 errno Note Edited: 0114018 View Revisions
2019-02-11 00:16 Bart Broersma LazTarget => -
2019-02-11 00:16 Bart Broersma Note Added: 0114022
2019-02-11 00:16 Bart Broersma Summary Under certain circonstances , projects options are not applied => Under certain circumstances, projects options are not applied
2019-02-16 12:20 errno Note Added: 0114177
2019-02-16 12:22 errno Note Edited: 0114177 View Revisions
2019-02-17 14:51 Juha Manninen Assigned To => Juha Manninen
2019-02-17 14:51 Juha Manninen Status new => assigned
2019-02-17 14:54 Juha Manninen Relationship added related to 0034283
2019-02-17 14:58 Juha Manninen Note Added: 0114220
2019-02-17 17:57 Juha Manninen Note Edited: 0114220 View Revisions
2019-02-17 23:24 errno Note Added: 0114233
2019-02-17 23:30 errno Note Edited: 0114233 View Revisions
2019-02-18 00:08 errno Note Edited: 0114233 View Revisions
2019-02-18 00:46 errno Note Edited: 0114233 View Revisions
2019-02-18 00:46 errno Note Edited: 0114233 View Revisions
2019-02-18 09:24 Juha Manninen Fixed in Revision => r60444
2019-02-18 09:24 Juha Manninen Note Added: 0114236
2019-02-18 09:24 Juha Manninen Status assigned => resolved
2019-02-18 09:24 Juha Manninen Resolution open => fixed
2019-02-18 13:08 errno Note Added: 0114238
2019-02-18 13:08 errno Status resolved => closed