[fpc-pascal] TStringList/pchar question

Ryan Joseph ryan at thealchemistguild.com
Sun Jun 2 20:11:12 CEST 2019


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;
strings.Free;
glShaderSource(vertexShaderID, 1, @vertexShaderSource, nil);

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list