Kodi freeze on channel scan with tvheadend

Hi community

I’m trying to perform a channel scan from Kodi GUI interface. I’m using Kodi 16.1 with Tvheadend server. I have added some HTS calls to the Tvheadend server and the pvr.hts plugin, to allow Kodi to make the channel frequency scan through the GUI Interface.

First I have wrote an small implementation of OpenDialogChannelScan on the pvr.hts to communicate with the Tvheadend and changed the capability bSupportsChannelScan. At this point all seems to work fine, but when try to test it on the Kodi, it freezes. I have searched into Kodi pvr base and the execution stops at the function

Code:
void CPVRClients::StartChannelScan(void)

The execution stops in this function when it tries to stop the supervisor thread

Code:
/* stop the supervisor thread */
g_PVRManager.StopUpdateThreads();

I can comment the stop/start actions on the supervisor thread, and it works fine, but after that i need to restart the Kodi to update the EPG database. This is updated automatically when the supervisor thread start.

Somebody have seen this problem before or has any idea how to solve it?

Best regards