View Issue Details

IDProjectCategoryView StatusLast Update
0036142LazarusIDEpublic2019-10-10 15:53
ReporterPascal RiekenbergAssigned ToMattias Gaertner 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Platformi386OSWindows 10 x64OS Version1903
Product VersionProduct Build62005 
Target VersionFixed in Version 
Summary0036142: IDE does not restart after building
DescriptionThe IDE does not restart after rebuild if requested to do so.
Additional InformationRebuild is done but no restarts happens. See Screenshot after build with reopended rebuild settings.
TagsNo tags attached.
Fixed in Revision62022.
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • restart.patch (4,439 bytes)
    Index: ide/buildmanager.pas
    ===================================================================
    --- ide/buildmanager.pas	(revision 62005)
    +++ ide/buildmanager.pas	(working copy)
    @@ -245,7 +245,6 @@
         procedure SetBuildTargetProject1; override; overload;
         procedure SetBuildTargetProject1(Quiet: boolean; ScanFPCSrc: TScanModeFPCSources = smsfsBackground); overload;
         procedure SetBuildTargetIDE; override;
    -    function BuildTargetIDEIsDefault: boolean; override;
     
         property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
         property BuildTarget: TProject read FBuildTarget; // TProject or nil
    @@ -2894,23 +2893,5 @@
       SetBuildTarget(NewTargetOS,NewTargetCPU,NewLCLWidgetSet,smsfsBackground,false);
     end;
     
    -function TBuildManager.BuildTargetIDEIsDefault: boolean;
    -var
    -  NewTargetOS: String;
    -  NewTargetCPU: String;
    -  NewLCLWidgetSet: TLCLPlatform;
    -begin
    -  with MiscellaneousOptions do begin
    -    NewTargetOS:=LowerCase(BuildLazOpts.TargetOS);
    -    NewTargetCPU:=LowerCase(BuildLazOpts.TargetCPU);
    -    NewLCLWidgetSet:=BuildLazOpts.TargetPlatform;
    -  end;
    -  //debugln(['TBuildManager.BuildTargetIDEIsDefault NewTargetOS=',NewTargetOS,' Default=',GetDefaultTargetOS,' NewTargetCPU=',NewTargetCPU,' default=',GetDefaultTargetCPU,' ws=',LCLPlatformDisplayNames[NewLCLWidgetSet],' default=',LCLPlatformDisplayNames[GetDefaultLCLWidgetType]]);
    -  Result:=((NewTargetOS='') or (NewTargetOS=GetCompiledTargetOS))
    -      and ((NewTargetCPU='') or (NewTargetCPU=GetCompiledTargetCPU))
    -      and (NewLCLWidgetSet<>lpNoGUI)
    -      and (GetCompilerFilename=EnvironmentOptions.GetParsedCompilerFilename);
    -end;
    -
     end.
     
    Index: ide/buildprofilemanager.pas
    ===================================================================
    --- ide/buildprofilemanager.pas	(revision 62005)
    +++ ide/buildprofilemanager.pas	(working copy)
    @@ -105,6 +105,7 @@
         fSelected: TStringList;
         fStaticAutoInstallPackages: TStringList;
         fCurrentIndex: integer;
    +    fDefaultIndex: integer;
         function GetCurrentProfile: TBuildLazarusProfile;
         function GetItems(Index: integer): TBuildLazarusProfile;
       public
    @@ -123,6 +124,7 @@
         property AllDefines: TStringList read fAllDefines;
         property Selected: TStringList read fSelected;
         property StaticAutoInstallPackages: TStringList read fStaticAutoInstallPackages;
    +    property DefaultIndex: integer read fDefaultIndex write fDefaultIndex;
         property CurrentIndex: integer read fCurrentIndex write fCurrentIndex;
         property Current: TBuildLazarusProfile read GetCurrentProfile;
         property Items[Index: integer]: TBuildLazarusProfile read GetItems; default;
    Index: ide/main.pp
    ===================================================================
    --- ide/main.pp	(revision 62005)
    +++ ide/main.pp	(working copy)
    @@ -7951,8 +7951,7 @@
       if (Result=mrOK) then begin
         with MiscellaneousOptions do begin
           if BuildLazProfiles.RestartAfterBuild
    -      and (BuildLazProfiles.Current.TargetDirectory='')
    -      and MainBuildBoss.BuildTargetIDEIsDefault then
    +      and (BuildLazProfiles.Current.TargetDirectory='') then
             mnuRestartClicked(nil);
         end;
       end else if Result=mrIgnore then
    @@ -7964,13 +7963,13 @@
       CmdLineDefines: TDefineTemplate;
       LazSrcTemplate: TDefineTemplate;
       LazSrcDirTemplate: TDefineTemplate;
    -  i, ProfInd, RealCurInd: Integer;
    +  i, ProfInd: Integer;
       MayNeedRestart: Boolean;
     begin
       Result:=mrOK;
       with MiscellaneousOptions do begin
         MayNeedRestart:=False;
    -    RealCurInd:=BuildLazProfiles.CurrentIndex;
    +    BuildLazProfiles.DefaultIndex:=BuildLazProfiles.CurrentIndex;
         try
           for i:=0 to ProfileNames.Count-1 do begin
             ProfInd:=BuildLazProfiles.IndexByName(ProfileNames[i]);
    @@ -7993,7 +7992,7 @@
               if (Result=mrOK) then begin
                 if BuildLazProfiles.RestartAfterBuild
                 and (BuildLazProfiles.Current.TargetDirectory='')
    -            and MainBuildBoss.BuildTargetIDEIsDefault then
    +            and (BuildLazProfiles.CurrentIndex=BuildLazProfiles.DefaultIndex) then
                   MayNeedRestart:=True
               end
               else if Result=mrIgnore then
    @@ -8003,7 +8002,7 @@
             end;
           end;
         finally
    -      BuildLazProfiles.CurrentIndex:=RealCurInd;
    +      BuildLazProfiles.CurrentIndex:=BuildLazProfiles.DefaultIndex;
         end;
         if MayNeedRestart and BuildLazProfiles.RestartAfterBuild then
           mnuRestartClicked(nil);
    
    restart.patch (4,439 bytes)

Activities

Pascal Riekenberg

2019-10-07 09:20

reporter  

Pascal Riekenberg

2019-10-07 16:24

reporter   ~0118392

The problem occurs when i have opened a project that has a different compiler (like x64 cross compiler).

Then "MainBuildBoss.BuildTargetIDEIsDefault" (Main.pp, 7980) returns false due to
"GetCompilerFilename=EnvironmentOptions.GetParsedCompilerFilename" (buildmanager.pas, 2913) beeing false.

GetCompilerFilename=C:\freepascal\fpc\trunk\bin\i386-win32\ppcrossx64.exe (set by current project)
EnvironmentOptions.GetParsedCompilerFilename=C:\freepascal\fpc\trunk\bin\i386-win32\ppc386.exe (used for compiling IDE)

Zeljan Rikalo

2019-10-07 19:43

developer   ~0118399

I've seen such problem under windows 10 virtual machine when switching from fpc-3.0.4 to fpc-3.2.0beta

Pascal Riekenberg

2019-10-07 20:46

reporter   ~0118400

Last edited: 2019-10-07 21:01

View 2 revisions

main.pp, 7972

function TMainIDE.DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult;
begin
  Result:=DoBuildLazarusSub(Flags);
  if (Result=mrOK) then begin
    with MiscellaneousOptions do begin
      if BuildLazProfiles.RestartAfterBuild
      and (BuildLazProfiles.Current.TargetDirectory='')
      and MainBuildBoss.BuildTargetIDEIsDefault then <<< why is this conditions needed here?
        mnuRestartClicked(nil);
    end;
  end else if Result=mrIgnore then
    Result:=mrOK;
end;

Pascal Riekenberg

2019-10-08 13:54

reporter   ~0118414

Shouldn't fix attached patch the issue?

If i investiagated correctly MainBuildBoss.BuildTargetIDEIsDefault is just do know if the current TBuildLazarusProfile is the default one.

restart.patch (4,439 bytes)
Index: ide/buildmanager.pas
===================================================================
--- ide/buildmanager.pas	(revision 62005)
+++ ide/buildmanager.pas	(working copy)
@@ -245,7 +245,6 @@
     procedure SetBuildTargetProject1; override; overload;
     procedure SetBuildTargetProject1(Quiet: boolean; ScanFPCSrc: TScanModeFPCSources = smsfsBackground); overload;
     procedure SetBuildTargetIDE; override;
-    function BuildTargetIDEIsDefault: boolean; override;
 
     property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
     property BuildTarget: TProject read FBuildTarget; // TProject or nil
@@ -2894,23 +2893,5 @@
   SetBuildTarget(NewTargetOS,NewTargetCPU,NewLCLWidgetSet,smsfsBackground,false);
 end;
 
-function TBuildManager.BuildTargetIDEIsDefault: boolean;
-var
-  NewTargetOS: String;
-  NewTargetCPU: String;
-  NewLCLWidgetSet: TLCLPlatform;
-begin
-  with MiscellaneousOptions do begin
-    NewTargetOS:=LowerCase(BuildLazOpts.TargetOS);
-    NewTargetCPU:=LowerCase(BuildLazOpts.TargetCPU);
-    NewLCLWidgetSet:=BuildLazOpts.TargetPlatform;
-  end;
-  //debugln(['TBuildManager.BuildTargetIDEIsDefault NewTargetOS=',NewTargetOS,' Default=',GetDefaultTargetOS,' NewTargetCPU=',NewTargetCPU,' default=',GetDefaultTargetCPU,' ws=',LCLPlatformDisplayNames[NewLCLWidgetSet],' default=',LCLPlatformDisplayNames[GetDefaultLCLWidgetType]]);
-  Result:=((NewTargetOS='') or (NewTargetOS=GetCompiledTargetOS))
-      and ((NewTargetCPU='') or (NewTargetCPU=GetCompiledTargetCPU))
-      and (NewLCLWidgetSet<>lpNoGUI)
-      and (GetCompilerFilename=EnvironmentOptions.GetParsedCompilerFilename);
-end;
-
 end.
 
Index: ide/buildprofilemanager.pas
===================================================================
--- ide/buildprofilemanager.pas	(revision 62005)
+++ ide/buildprofilemanager.pas	(working copy)
@@ -105,6 +105,7 @@
     fSelected: TStringList;
     fStaticAutoInstallPackages: TStringList;
     fCurrentIndex: integer;
+    fDefaultIndex: integer;
     function GetCurrentProfile: TBuildLazarusProfile;
     function GetItems(Index: integer): TBuildLazarusProfile;
   public
@@ -123,6 +124,7 @@
     property AllDefines: TStringList read fAllDefines;
     property Selected: TStringList read fSelected;
     property StaticAutoInstallPackages: TStringList read fStaticAutoInstallPackages;
+    property DefaultIndex: integer read fDefaultIndex write fDefaultIndex;
     property CurrentIndex: integer read fCurrentIndex write fCurrentIndex;
     property Current: TBuildLazarusProfile read GetCurrentProfile;
     property Items[Index: integer]: TBuildLazarusProfile read GetItems; default;
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 62005)
+++ ide/main.pp	(working copy)
@@ -7951,8 +7951,7 @@
   if (Result=mrOK) then begin
     with MiscellaneousOptions do begin
       if BuildLazProfiles.RestartAfterBuild
-      and (BuildLazProfiles.Current.TargetDirectory='')
-      and MainBuildBoss.BuildTargetIDEIsDefault then
+      and (BuildLazProfiles.Current.TargetDirectory='') then
         mnuRestartClicked(nil);
     end;
   end else if Result=mrIgnore then
@@ -7964,13 +7963,13 @@
   CmdLineDefines: TDefineTemplate;
   LazSrcTemplate: TDefineTemplate;
   LazSrcDirTemplate: TDefineTemplate;
-  i, ProfInd, RealCurInd: Integer;
+  i, ProfInd: Integer;
   MayNeedRestart: Boolean;
 begin
   Result:=mrOK;
   with MiscellaneousOptions do begin
     MayNeedRestart:=False;
-    RealCurInd:=BuildLazProfiles.CurrentIndex;
+    BuildLazProfiles.DefaultIndex:=BuildLazProfiles.CurrentIndex;
     try
       for i:=0 to ProfileNames.Count-1 do begin
         ProfInd:=BuildLazProfiles.IndexByName(ProfileNames[i]);
@@ -7993,7 +7992,7 @@
           if (Result=mrOK) then begin
             if BuildLazProfiles.RestartAfterBuild
             and (BuildLazProfiles.Current.TargetDirectory='')
-            and MainBuildBoss.BuildTargetIDEIsDefault then
+            and (BuildLazProfiles.CurrentIndex=BuildLazProfiles.DefaultIndex) then
               MayNeedRestart:=True
           end
           else if Result=mrIgnore then
@@ -8003,7 +8002,7 @@
         end;
       end;
     finally
-      BuildLazProfiles.CurrentIndex:=RealCurInd;
+      BuildLazProfiles.CurrentIndex:=BuildLazProfiles.DefaultIndex;
     end;
     if MayNeedRestart and BuildLazProfiles.RestartAfterBuild then
       mnuRestartClicked(nil);
restart.patch (4,439 bytes)

Pascal Riekenberg

2019-10-10 08:57

reporter   ~0118456

Could anyone have a look at this, please?

Issue History

Date Modified Username Field Change
2019-10-07 09:20 Pascal Riekenberg New Issue
2019-10-07 09:20 Pascal Riekenberg File Added: Anmerkung 2019-10-07 091456.jpg
2019-10-07 16:24 Pascal Riekenberg Note Added: 0118392
2019-10-07 19:43 Zeljan Rikalo Note Added: 0118399
2019-10-07 20:46 Pascal Riekenberg Note Added: 0118400
2019-10-07 21:01 Pascal Riekenberg Note Edited: 0118400 View Revisions
2019-10-08 13:54 Pascal Riekenberg File Added: restart.patch
2019-10-08 13:54 Pascal Riekenberg Note Added: 0118414
2019-10-10 08:57 Pascal Riekenberg Note Added: 0118456
2019-10-10 14:31 Mattias Gaertner Assigned To => Mattias Gaertner
2019-10-10 14:31 Mattias Gaertner Status new => assigned
2019-10-10 14:32 Mattias Gaertner Status assigned => resolved
2019-10-10 14:32 Mattias Gaertner Resolution open => fixed
2019-10-10 14:32 Mattias Gaertner Fixed in Revision => 62022.
2019-10-10 14:32 Mattias Gaertner LazTarget => -
2019-10-10 14:32 Mattias Gaertner Widgetset Win32/Win64 => Win32/Win64
2019-10-10 15:53 Pascal Riekenberg Status resolved => closed