2011/5/26 Martin <[email protected]>:
> 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

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to