修正 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
+2 -1
View File
@@ -666,7 +666,8 @@ public //
if ifobj(otype)then
begin
iv := otype.UnformatEdit(v); //反转换
if FChangedProperties[n]=vi then continue; //没有改变
//if FChangedProperties[n]=vi then continue; //没有改变
if FChangedProperties[n]=iv then continue; //没有改变
SetChangedPublish(n,iv,pp); //保存
if n="visible" or n="wspopup" or n="enabled" then
begin
+1
View File
@@ -310,6 +310,7 @@ BFC6105000000097048597300000EC300000EC301C76FA8640000010D49444154
bmp := new TcustomBitmap();
bmp.readvcon(HexFormatStrToTsl(getsxbmp()));
fsplitterdragimglist.addbmp(bmp);
bmp := new TcustomBitmap();
bmp.readvcon(HexFormatStrToTsl(getzybmp()));
fsplitterdragimglist.addbmp(bmp);
end
+2
View File
@@ -2094,7 +2094,9 @@ type TWinControl = class(tcontrol)
FTRACKMOUSEEVENT.dwflags := TME_CANCEL .| TME_HOVER .| TME_LEAVE;
_wapi.TrackMouseEvent(FTRACKMOUSEEVENT._getptr_);
end }
bv := FVisible;
_wapi.DestroyWindow(self.Handle);
FVisible := bv;
end
FHandle := 0;
end
+2 -2
View File
@@ -1975,8 +1975,8 @@ type tsgtkapi = class(tgtkapis)
cairo_fill(dc);
cairo_move_to(dc,LPRECT[0]+x+2,LPRECT[1]+y+(LPRECT[3]-LPRECT[1])/3);
cairo_line_to(dc,LPRECT[0]+x+(LPRECT[2]-LPRECT[0])/3,LPRECT[3]-2);
cairo_line_to(dc,LPRECT[2]-2,LPRECT[1]+y+(LPRECT[3]-LPRECT[1])/4);
cairo_line_to(dc,LPRECT[0]+x+(LPRECT[2]-LPRECT[0])/3,y+LPRECT[3]-2);
cairo_line_to(dc,LPRECT[2]+x-2,LPRECT[1]+y+(LPRECT[3]-LPRECT[1])/4);
cairo_set_source_rgb(dc,100/255,100/255,100/255);
cairo_set_line_width(dc,4);
cairo_stroke(dc);
+1
View File
@@ -412,6 +412,7 @@ type tcustomcoolbar=class(tcustomcontrol)
bmp := new TcustomBitmap();
bmp.readvcon(HexFormatStrToTsl(getmovebmp()));
FDRageimglist.addbmp(bmp);
bmp := new TcustomBitmap();
bmp.readvcon(HexFormatStrToTsl(getsizebmp()));
FDRageimglist.addbmp(bmp);
end
+4 -1
View File
@@ -1928,13 +1928,16 @@ type TCustomImageList=class(tcomponent)
addIcon(bmp.ToIcon());
if FimageCount>ct then
begin
FBmpItems.push(bmp);
//////////////拷贝bitamp不销毁///////////////////
{
nbmp := new tcustombitmap();
bmp.AutoDestroy := false;
nbmp.Handle := bmp.Handle;
nbmp.AutoDestroy := true;
//////////////////////////////
FBmpItems.push(nbmp);
//////////////////////////////
}
end
finally
FBmpAdding := false;
+152 -22
View File
@@ -527,6 +527,8 @@ type tfm = class(tvcform)
end
}
function point_in_rgn(p,rgn_); //判断点是否在区域中
function graph_paint_lines(cvs,linestyle,xys,closed,ifo); //根据给定点绘制线
function graph_paint_points(mk,cvs,xys); //根据点信息绘制点
type tg_WinControl = class(tcustomcontrol,tg_const) //绘图窗口
function create(AOwner);
begin
@@ -3748,12 +3750,13 @@ type tg_Polyline = class(tg_graph) //
end
end
type tg_line_info = class(tg_const) //线型信息
function create();
function create(awer);
begin
fcolor := 0;
FWidth := 1;
FStyle := tgc_PS_SOLID;
fbkcolor := nil;
fonwer := awer;
end
function clone();
begin
@@ -3765,24 +3768,64 @@ type tg_line_info = class(tg_const) //
r.bkcolor := fbkcolor;
return r;
end
property Style read FStyle write FStyle;
property width read FWidth write fwidth;
property size read FWidth write fwidth;
property color read fcolor write fcolor;
property bkcolor read fbkcolor write fbkcolor;
property style index "style" read FStyle write setpropid;
property width index "width" read FWidth write setpropid;
property size index "size" read FWidth write setpropid;
property color index "color" read fcolor write setpropid;
property bkcolor index "bkcolor" read fbkcolor write setpropid;
private
fwidth;
fcolor;
FStyle;
fbkcolor;
function setpropid(id,v);
begin
case id of
"style":
begin
if FStyle<>v and ifnumber(v) then
begin
FStyle := v;
if fonwer then fonwer.invalidate();
end
end
"width","size":
begin
if FWidth<>v and ifnumber(v) then
begin
FWidth := v;
if fonwer then fonwer.invalidate();
end
end
"color":
begin
if fcolor<>v and ifnumber(v) then
begin
fcolor := v;
if fonwer then fonwer.invalidate();
end
end
"bkcolor":
begin
if fbkcolor<>v and ifnumber(v) then
begin
fbkcolor := v;
if fonwer then fonwer.invalidate();
end
end
end;
end
[weakref]fonwer;
end
type tg_font_info = class(tg_const) //字体信息
function create();
function create(awner);
begin
fstyle := nil;
fsize := 7;
fforeground := 0;
fbackground := nil;
fonwer := awner;
end
function clone();
begin
@@ -3793,25 +3836,65 @@ type tg_font_info = class(tg_const) //
r.bkcolor := fbackground;
return r;
end
property style read fstyle write fstyle;
property size read fsize write fsize;
property color read fforeground write fforeground;
property bkcolor read fbackground write fbackground;
property style index "style" read fstyle write setpropid;
property size index "size" read fsize write setpropid;
property color index "color" read fforeground write setpropid;
property bkcolor index "bkcolor" read fbackground write setpropid;
private
fstyle;
fsize;
fsize_unit;
fforeground;
fbackground;
fbackground;
[weakref]fonwer;
function setpropid(id,v);
begin
case id of
"style":
begin
if FStyle<>v and ifnumber(v) then
begin
FStyle := v;
if fonwer then fonwer.invalidate();
end
end
"size":
begin
if fsize<>v and ifnumber(v) then
begin
fsize := v;
if fonwer then fonwer.invalidate();
end
end
"color":
begin
if fforeground<>v and ifnumber(v) then
begin
fforeground := v;
if fonwer then fonwer.invalidate();
end
end
"bkcolor":
begin
if fbackground<>v and ifnumber(v) then
begin
fbackground := v;
if fonwer then fonwer.invalidate();
end
end
end;
end
end
type tg_mark_info = class(tg_const) //标记信息
function create();
function create(awner);
begin
fstyle := tgc_mks_dot;
fsize := 0;
fsize_unit := tgc_mk_point;
fforeground := 0;
fbackground := 0xffffff;
fonwer := awner;
end
function clone();
begin
@@ -3823,17 +3906,55 @@ type tg_mark_info = class(tg_const) //
r.bkcolor := fbackground;
return r;
end
property style read fstyle write fstyle;
property size read fsize write fsize;
property style index "style" read fstyle write setpropid;
property size index "size" read fsize write setpropid;
property size_unit read fsize_unit write fsize_unit;
property color read fforeground write fforeground;
property bkcolor read fbackground write fbackground;
property color index "color" read fforeground write setpropid;
property bkcolor index "bkcolor" read fbackground write setpropid;
private
fstyle;
fsize;
fsize_unit;
fforeground;
fbackground;
fbackground;
[weakref]fonwer;
function setpropid(id,v);
begin
case id of
"style":
begin
if FStyle<>v and ifnumber(v) then
begin
FStyle := v;
if fonwer then fonwer.invalidate();
end
end
"size":
begin
if fsize<>v and ifnumber(v) then
begin
fsize := v;
if fonwer then fonwer.invalidate();
end
end
"color":
begin
if fforeground<>v and ifnumber(v) then
begin
fforeground := v;
if fonwer then fonwer.invalidate();
end
end
"bkcolor":
begin
if fbackground<>v and ifnumber(v) then
begin
fbackground := v;
if fonwer then fonwer.invalidate();
end
end
end;
end
end
type tg_evet_conainter = class(tg_const) //带消息的绘图基类
function create();
@@ -3872,9 +3993,9 @@ type tg_base = class(TNode,tg_evet_conainter) //
fenabled := tgc_on;
fline_mode := tgc_off;
fmark_mode := tgc_off;
flineinfo := new tg_line_info();
fmarkinfo := new tg_mark_info();
ffontinfo := new tg_font_info();
flineinfo := new tg_line_info(self(true));
fmarkinfo := new tg_mark_info(self(true));
ffontinfo := new tg_font_info(self(true));
end
function axes_mapping(x,y,z,_x,_y);virtual; //
begin
@@ -3973,6 +4094,7 @@ type tg_base = class(TNode,tg_evet_conainter) //
end
function invalidate(); //刷新
begin
if tgc_off=fvisibe then return ;
if fchange_locked then return ;
axs := get_axes();
if axs then
@@ -4388,6 +4510,14 @@ begin
_x := x*cos(ag)+y*sin(ag);
_y := -x*sin(ag)+y*cos(ag);
end
function graph_paint_lines(cvs,pls,xys,cls,ifo);
begin
return paint_lines(cvs,pls,xys,cls,ifo);
end
function graph_paint_points(mk,dc,xys);
begin
return paint_marks(mk,dc,xys);
end
function paint_lines(cvs,pls,xys,cls,ifo);//划线
begin
o := static new tg_const();
@@ -4493,7 +4623,7 @@ begin
end
end
end
function paint_marks(mk,dc,xys); //绘制
function paint_marks(mk,dc,xys); //绘制marks;
begin
o := static new tg_const();
tp := mk.Style;
@@ -937,6 +937,7 @@ type TTmfParser = class(TTmfParserbase)
public
property Script write SetScript;
property ScriptPath write SetScriptPath;
property tokens read FTokens; //获得token数据
{**
@param(Script)(string) 设置脚本文件 %%
@param(ScriptPath)(string) 脚本路径 %%