修正 imagelist中bmp可能销毁导致的异常

This commit is contained in:
2024-07-31 14:40:02 +08:00
parent d412eb1cfc
commit ebed3be229
12 changed files with 195 additions and 36 deletions
+6 -3
View File
@@ -1392,7 +1392,7 @@ type tsearchdir = class(TCustomControl)
inherited;
caption := "函数搜索目录:左侧为别名,右侧为-libpath目录....";
WsDlgModalFrame := true;
//WSSizebox := true;
WSSizebox := true;
visible := false;
wsPopUp := true;
WsSysMenu := true;
@@ -1609,7 +1609,7 @@ type tsearchdir = class(TCustomControl)
FLists;
FBtns;
end
private
private
function GetIcon();
begin
r := "0502000000060400000074797065000203000000696D670006040000006461746
@@ -1804,8 +1804,10 @@ type tdirviewer = class(tcustomcontrol)
bmp := new TBitmap();
bmp.readvcon(HexFormatStrToTsl(folderbmp()));
fimgs.addbmp(bmp);
bmp := new TBitmap();
bmp.readvcon(HexFormatStrToTsl(filebmp()));
fimgs.addbmp(bmp);
bmp := new TBitmap();
bmp.readvcon(HexFormatStrToTsl(dllbmp()));
fimgs.addbmp(bmp);
ftbns := array();
@@ -1813,7 +1815,8 @@ type tdirviewer = class(tcustomcontrol)
for i,v in gettbicons() do
begin
bt := new TToolButton(ftb);
bt.caption := i;
bt.caption := i;
bmp := new TBitmap();
bmp.readvcon(HexFormatStrToTsl(v));
fimgs.addbmp(bmp);
bt.ImageId := fimgs.ImageCount-1;
+4 -4
View File
@@ -1079,7 +1079,7 @@ type TProjectView = class(TVCForm) //
end
////////////////////从新构造search目录///////////////////////////////
global g_orig_lib_path;
sdir := array(p);
sdir := array(p+fio);
idx := 1;
hdirs := array(p:true);
if ifstring(g_orig_lib_path) then
@@ -1749,7 +1749,7 @@ end
end
private
FMoveMnus;
FMoveMenu;
FMoveMenu;
function getnodebyfilename(f,nd);//获得编辑器对应节点
begin
if not nd then return 0;
@@ -2657,10 +2657,10 @@ type TFileTree = class(TTreeCtl)
function CreateaImageList(AOwner,imgns);
begin
imgs := New TControlImageList(AOwner);
imgns := array();
bmp := new TBitmap();
imgns := array();
for i,v in GetIcons() do
begin
bmp := new TBitmap();
bmp.ReadVCon(HexFormatStrToTsl(v));
imgs.AddBmp(bmp);
imgns[i]:= k;
+1 -1
View File
@@ -1880,7 +1880,6 @@ type TEditer=class(TCustomcontrol) //
FImages := new TControlImageList(self);
FImages.Width := 24;
FImages.Height := 24;
bmp := new TBitmap();
imgs := GetEditIcons();
id := 0;
FToolbtns := array();
@@ -1895,6 +1894,7 @@ type TEditer=class(TCustomcontrol) //
continue;
end else
begin
bmp := new TBitmap();
bmp.Readvcon(HexFormatStrToTsl(v));
FImages.addbmp(bmp);
bt.OnClick := thisfunction(ToolClick);
+19 -2
View File
@@ -2298,9 +2298,10 @@ type TTsfFileParser = class() //
ClearCache(FFindDirs?true:false);
end
end
function DirSet(d); //设置
function DirSet(d_); //设置
begin
if not ifarray(d) then return FFindDirs;
if not ifarray(d_) then return FFindDirs;
d := format_dirs(d_);
if d=FFindDirs then return d;
r := FFindDirs;
FFinddirsseted := true;
@@ -2312,6 +2313,22 @@ type TTsfFileParser = class() //
end
return r;
end
function format_dirs(d);
begin
r := array();
idx := 0;
for i,v in d do
begin
if ifstring(v) and v then
begin
vlen := length(v);
if v[vlen]=fiofs then r[idx] := v[1:(vlen-1)];
else r[idx] := v;
idx++;
end
end
return r;
end
function ClearCache(cl); //清空缓存
begin
if cl then