Re: [fpc-pascal] TStringList/pchar question

2019-06-02 Thread Ryan Joseph
> On Jun 2, 2019, at 2:48 PM, Michael Van Canneyt > wrote: > >> I just learned that pchar is not ref counted like I used to think so I’m >> curious why this code doesn’t fail. Shouldn’t this crash because I free >> TStringList and then access GetText? > > You're first doing gettext and

Re: [fpc-pascal] TStringList/pchar question

2019-06-02 Thread Michael Van Canneyt
On Sun, 2 Jun 2019, Ryan Joseph wrote: I just learned that pchar is not ref counted like I used to think so I’m curious why this code doesn’t fail. Shouldn’t this crash because I free TStringList and then access GetText? You're first doing gettext and then freeing. So this is OK.

[fpc-pascal] TStringList/pchar question

2019-06-02 Thread Ryan Joseph
I just learned that pchar is not ref counted like I used to think so I’m curious why this code doesn’t fail. Shouldn’t this crash because I free TStringList and then access GetText? strings := TStringList.Create; strings.LoadFromFile(vertexShaderPath); vertexShaderSource := strings.GetText;