IDE: TProjectIcon: do not set icon twice when loading

git-svn-id: branches/fixes_1_2@44060 -
This commit is contained in:
mattias 2014-02-13 23:19:30 +00:00
parent 61f60e1e57
commit b0448f6f30

View File

@ -177,6 +177,7 @@ var
begin
Result := False;
if IsEmpty then exit;
//debugln(['TProjectIcon.CreateIconFile ',FIcoFileName]);
try
if FileExistsUTF8(FIcoFileName) then
fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenWrite)
@ -207,6 +208,7 @@ procedure TProjectIcon.SetIsEmpty(const AValue: Boolean);
var
NewData: TIconData;
fs: TFileStreamUTF8;
ok: Boolean;
begin
if IsEmpty=AValue then exit;
if AValue then
@ -214,7 +216,7 @@ begin
else
begin
// We need to restore data from the .ico file
IconData := nil;
ok:=false;
try
fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenRead);
try
@ -222,11 +224,14 @@ begin
if length(NewData)>0 then
fs.Read(NewData[0],length(NewData));
IconData := NewData;
ok:=true;
finally
fs.Free
end;
except
end;
if not ok then
IconData:=nil;
end;
Modified := True;
end;