unregister event listeners on disable

develop
Myk Taylor 2023-11-04 19:10:19 -07:00
parent f93bb60b3b
commit f5d0c5b291
No known key found for this signature in database
1 changed files with 2 additions and 0 deletions

@ -66,6 +66,8 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
init_diggers(out); init_diggers(out);
EventManager::registerListener(EventManager::EventType::JOB_STARTED, EventManager::EventHandler(jobStartedHandler, 0), plugin_self); EventManager::registerListener(EventManager::EventType::JOB_STARTED, EventManager::EventHandler(jobStartedHandler, 0), plugin_self);
EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, EventManager::EventHandler(jobCompletedHandler, 0), plugin_self); EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, EventManager::EventHandler(jobCompletedHandler, 0), plugin_self);
} else {
EventManager::unregisterAll(plugin_self);
} }
} }
else { else {