RTC Forums

Subscription => Support => Topic started by: HelgeLange on April 27, 2016, 06:28:49 PM



Title: Access violation when windows app shuts down
Post by: HelgeLange on April 27, 2016, 06:28:49 PM
Hi Danijel,

I have some not so rare and still strange access violations in some RTC Timer when the app shuts down.
At first I thought something with the disconnect (I have 2 RtcHHttpClient comps in a datamodule), I made sure to disconnect them when the app shuts down with DisconnectNow(True)

When running outside the IDE it causes the program to stay in memory.

I'm running out of ideas where to look for a solution.. any ideas ?

Thanks in advance,
Helge


Title: Re: Access violation when windows app shuts down
Post by: D.Tkalcec (RTC) on April 28, 2016, 01:03:11 PM
Access Violations happen when objects or memory are being access which have already been freed.

If the problem only happens when you are closing your Application, you have to make sure that all RTC threads are idle before destroying any objects or releasing any memory which is used by RTC components or in any way linked to the components. This means closing all RTC connections, making sure that your code which could result in an automatic reconnect attempt is disabled, any RTC Timers you may have created are stopped and there are no pending jobs in any TRtcQuickJob component.

For example ... before destroying a Form or a DataModule with events used by a TRtcHttpClient component, or any number of TRtcDataRequest, TRtcClientModule or TRtcResult components using a TRtcHttpClient component in Multi-Threaded mode, make sure there are no pending remote calls or data requests and the connection on the TRtcHttpClient component is closed.

Best Regards,
Danijel Tkalcec


Title: Re: Access violation when windows app shuts down
Post by: D.Tkalcec (RTC) on April 28, 2016, 01:34:11 PM
By the way ... if you haven't done that already, I recommend updating to the latest RTC SDK version (7.18) and checking if that makes any difference. There was a bug in the rtcHwndPool unit (fixed in v7.18 update), which could have resulted in an Access Violation if there was a connection active during shutdown.

Best Regards,
Danijel Tkalcec