IWBootstrapFramework
IWBootstrapFramework copied to clipboard
IWBSButton DataTarget will create an access violation on destroy with FastMM enabled.
FastMM will raise an exception when DataTarget is assigned on a IWBSButton and destruction of the form. This is a work around I have found to ensure it is set to NIL
destructor TIWBSButton.Destroy;
var
LDataTarget: Pointer;
begin
try
if Assigned(FDataTarget) then
begin
LDataTarget := @FDataTarget;
if LDataTarget <> nil then
begin
try
Pointer(FDataTarget) := nil;
except
end;
end;
end;
finally
inherited;
end;
end;
To replicate enabled FastMM4 debug options on the IWBSDemo start demo and then exit.
To fix without using this above, edit Unit2 and add a FormDestroy event
IWBSButton49.DataTarget := nil;
Yes, I can reproduce this.
But what is the reason for this happening? Why only happen with FullDebugMode enabled? Why only happen with FDataTarget and not with FDataParent?
And how did you find this fix?
Might be because de IDE itself is holding a reference to the interface - this way the object will not be freed when de application is closed and FastMM collects the informaiton about non-freed memory.
You can reproduce this even with a simple project without FastMM and 'ReportMemoryLeaksOnShutdown' set to true. Just at the 'DataTarget' to your watchlist....