[Lazarus] TTreeView, string and SIGSEGV
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Aug 26 14:53:32 CEST 2013
On Mon, 26 Aug 2013 16:45:35 +0800
Xiangrong Fang <xrfang at gmail.com> wrote:
> Ok, that's reasonable, however:
>
> 1) If I use Move() is there a "manual" way to increate the string ref count?
Yes, but it is better to let the compiler do the work:
p^:=PNode(tv.Selected.Data)^;
> 2) why the error is gone if I change this line:
>
> prev := tv.Items.InsertObjectBehind(prev, p^.title, p);
>
> to this:
>
> prev := tv.Items.InsertObjectBehind(prev, 'Node #' + IntToStr(i), p);
>
> 3) Why this error does not happen on node #0 and #3, but only node #1 and
> #2?
>
> 4) Why it behaves different on Windows and Linux?
All this has the same answer:
When you mess up the heap you get results depending on the current
memory, which depends on lots of stuff. The results
can vary from host to host and might not even be the same on each run.
In other words: random.
Windows and Linux have different approaches how to initialize memory,
so you see differences more likely.
Mattias
More information about the Lazarus
mailing list