Hi
I had that exact problem once, it was a PITFA!
I even stood on my head before the laptop, ...nothing seemed to cure it.
It turned out to be a deeply buried "double free" in my code(not fpc/lazarus).
At the point, where I found it, my code was riddled(nothing else than) with "try-except LogLn; end" I even changed parts of the LCL, hunting it down...
What I'm saying is, it can be a teensy-weensy-tiny bit, that only shows its ugly head on spurious occasions, that tips the wagon.
So, it's time to go hunting and preferably show us the entire code, if possible.
Regards Benny