When the user closes a running application that is communicating through TVaCustomComm it sometimes raises an EAccessViolation during teardown.
It seems to be the FreeMem(FData) in TVaCommBuffer.Destroy that throws the exception.
I call TVaCustomComm.Close from the application MainForm's FormClose.
Can you try to add a call to
Sleep(200) after calling Vacomm.Close.
The actual cleanup of the VaComm internal thread can take some time.
Added the Sleep(200), but the exception still occurs.
Actually I can provoke the exception without closing the app. just by calling VaComm.Close (Still just sometimes though).
I wonder if memory is messed up in my app...
That is strange. Is there still data being handled when you call Close()?
Can you also try to do a Purge of the buffer before calling Close()?
Yes, it was while communication was still running.
I think I was overtaken by events in queue. An extra state control variable seems to have solved the issue.
Thanks for your time. :o)