Reconnection to the events after ApiUtil.cleanup()

This is bug, reported in PyTango: pytango#712

The origin of the bug is that when we do cleanup, we shutdown EventConsumer, where we do cleanup_EventChannel_map

Here we assign to the adm_device_proxy nullptr, but, and this is my main question - we store event channel map

Later, we new client subscribes, it looks to the map and if it finds event, then we pick up old adm_device_proxy without check if it is NULL

And in couple of step we tries to deref it and crash

I can add a check if adm_device_proxy is NULL (as it done in some places), but this is not only adm_device_proxy, we also nullify channel_monitor and callback_monitor when we do cleanup_EventChannel_map. So my question is: what for then we still store both channel_map and event_callback_map if they are broken? Sould we just clean them too?

Edited by Yury Matveev