[Lazarus] Access violation in SYSGETMEM_FIXED - memory corruption?
cobines
cobines at gmail.com
Fri May 27 03:07:37 CEST 2011
2011/5/26 Martin <lazarus at mfriebe.de>:
> Here is what happens
> ...
Ah, now I see. Thanks for explaining.
If I think of
edtIconFileName.Text
as
edtIconFileName.SetText(const s);
it becomes more visible that in the trigger edtIconFileNameChange I
cannot change what I am assigning.
So, from what you're saying it is enough to temporarily increase
reference count before assigning to edtIconFileName.Text. If I modify
the code to be like this:
procedure TfrmFileAssoc.btnAddNewTypeClick(Sender: TObject);
var
s: String;
begin
s := TExtAction(Exts.Items[0]).Icon;
edtIconFileName.Text:= s;
end;
there is no crash and refcount is 2 when SetText is called. And 's' is
finalized after assignment to Text.
--
cobines
More information about the Lazarus
mailing list