[Lazarus] what can be wrong in this code? (qrobjects.pas)

Ondrej Pokorny lazarus at kluug.net
Wed Oct 14 19:55:19 CEST 2015


On 14.10.2015 13:22, Mattias Gaertner wrote:
> On Wed, 14 Oct 2015 13:41:30 +0300
> FreeMan<freeman35 at delphiturkiye.com>  wrote:
>
>> >[...]
>> >note:
>> >after this error, in editor toolbar I have "Open packages of current
>> >unit" icon, its start blink.?
> I see this too under Linux/Gtk2.

Since freeman hasn't created a bug report and I am too lazy to write one 
myself, I sent the patch here.

Ondrej
-------------- next part --------------
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 50059)
+++ ide/main.pp	(working copy)
@@ -3729,16 +3729,19 @@
   CanOpenPkgOfFile, CanAddCurFile: Boolean;
 begin
   GetCurrentUnit(ASrcEdit,AUnitInfo);
-  if Assigned(AUnitInfo) and (AUnitInfo.Filename <> FLastUnitInfoFileName) then
+  if Assigned(AUnitInfo) then
   begin
-    PkgFile:=PackageGraph.FindFileInAllPackages(AUnitInfo.Filename,true,
-                                          not AUnitInfo.IsPartOfProject);
-    CanOpenPkgOfFile:=Assigned(PkgFile);
-    CanAddCurFile:=(not AUnitInfo.IsVirtual) and FileExistsUTF8(AUnitInfo.Filename)
-          and not AUnitInfo.IsPartOfProject;
-    MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=CanOpenPkgOfFile;
-    MainIDEBar.itmPkgAddCurFileToPkg.Enabled:=CanAddCurFile;
-    FLastUnitInfoFileName := AUnitInfo.Filename;
+    if (AUnitInfo.Filename <> FLastUnitInfoFileName) then
+    begin
+      PkgFile:=PackageGraph.FindFileInAllPackages(AUnitInfo.Filename,true,
+                                            not AUnitInfo.IsPartOfProject);
+      CanOpenPkgOfFile:=Assigned(PkgFile);
+      CanAddCurFile:=(not AUnitInfo.IsVirtual) and FileExistsUTF8(AUnitInfo.Filename)
+            and not AUnitInfo.IsPartOfProject;
+      MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=CanOpenPkgOfFile;
+      MainIDEBar.itmPkgAddCurFileToPkg.Enabled:=CanAddCurFile;
+      FLastUnitInfoFileName := AUnitInfo.Filename;
+    end;
   end else
   begin
     MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=False;


More information about the Lazarus mailing list