mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 06:39:13 +02:00
IDE: TProjectIcon: do not set icon twice when loading
git-svn-id: trunk@44057 -
This commit is contained in:
parent
05e6ad8dab
commit
84346a8450
@ -181,6 +181,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if IsEmpty then exit;
|
if IsEmpty then exit;
|
||||||
|
//debugln(['TProjectIcon.CreateIconFile ',FIcoFileName]);
|
||||||
try
|
try
|
||||||
if FileExistsUTF8(FIcoFileName) then
|
if FileExistsUTF8(FIcoFileName) then
|
||||||
fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenWrite)
|
fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenWrite)
|
||||||
@ -211,6 +212,7 @@ procedure TProjectIcon.SetIsEmpty(const AValue: Boolean);
|
|||||||
var
|
var
|
||||||
NewData: TIconData;
|
NewData: TIconData;
|
||||||
fs: TFileStreamUTF8;
|
fs: TFileStreamUTF8;
|
||||||
|
ok: Boolean;
|
||||||
begin
|
begin
|
||||||
if IsEmpty=AValue then exit;
|
if IsEmpty=AValue then exit;
|
||||||
if AValue then
|
if AValue then
|
||||||
@ -218,7 +220,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// We need to restore data from the .ico file
|
// We need to restore data from the .ico file
|
||||||
IconData := nil;
|
ok:=false;
|
||||||
try
|
try
|
||||||
fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenRead);
|
fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenRead);
|
||||||
try
|
try
|
||||||
@ -226,11 +228,14 @@ begin
|
|||||||
if length(NewData)>0 then
|
if length(NewData)>0 then
|
||||||
fs.Read(NewData[0],length(NewData));
|
fs.Read(NewData[0],length(NewData));
|
||||||
IconData := NewData;
|
IconData := NewData;
|
||||||
|
ok:=true;
|
||||||
finally
|
finally
|
||||||
fs.Free
|
fs.Free
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
|
if not ok then
|
||||||
|
IconData:=nil;
|
||||||
end;
|
end;
|
||||||
Modified := True;
|
Modified := True;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user