MCPcopy Create free account
hub / github.com/DFHack/dfhack / unregister

Method unregister

library/modules/EventManager.cpp:112–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void DFHack::EventManager::unregister(EventType::EventType e, EventHandler handler) {
113 for ( auto i = handlers[e].find(handler.plugin); i != handlers[e].end(); ) {
114 if ( (*i).first != handler.plugin )
115 break;
116 EventHandler &handle = (*i).second;
117 if ( handle != handler ) {
118 i++;
119 continue;
120 }
121 DEBUG(log).print("unregistering handler {} from plugin {} for event {}\n",
122 reinterpret_cast<void*>(handler.eventHandler),
123 handler.plugin ? handler.plugin->getName() : "<null>",
124 static_cast<int>(e));
125 i = handlers[e].erase(i);
126 if ( e == EventType::TICK )
127 removeFromTickQueue(handler);
128 }
129}
130
131void DFHack::EventManager::unregisterAll(Plugin* plugin) {
132 DEBUG(log).print("unregistering all handlers for plugin {}\n",

Callers

nothing calls this directly

Calls 6

removeFromTickQueueFunction · 0.85
findMethod · 0.45
endMethod · 0.45
printMethod · 0.45
getNameMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected