Destroy reference to taskmgr after all tasks are done
We were clearing the pointer to taskmgr as soon as isc_taskmgr_destroy() would be called and before all tasks were finished. Unfortunately, some tasks would use global named_g_taskmgr objects from inside the events and this would cause either a data race or NULL pointer dereference.
This commit fixes the data race by moving the destruction of the referenced pointer to the time after all tasks are finished.
See #2638 (closed)
Edited by Michał Kępień