From 375b03c132f045a66b710688142fc2dd93e84caa Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 29 Jun 2019 09:51:23 +0200 Subject: [PATCH] Fix (just created) bug in extcmode unloading (with param). Update slot/param mapping. Now unloading should work well... otherwise it crashed after destroying the channel. --- src/extcmodes.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/extcmodes.c b/src/extcmodes.c index 61b102dd4..903603283 100644 --- a/src/extcmodes.c +++ b/src/extcmodes.c @@ -141,6 +141,15 @@ void extcmode_para_addslot(Cmode *c, int slot) param_to_slot_mapping[c->flag] = slot; } +/* Update letter->slot mapping and slot->handler mapping */ +void extcmode_para_delslot(Cmode *c, int slot) +{ + if ((slot < 0) || (slot > MAXPARAMMODES)) + abort(); + ParamTable[slot] = NULL; + param_to_slot_mapping[c->flag] = 0; +} + Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode) { short i = 0, j = 0; @@ -298,6 +307,7 @@ void unload_extcmode_commit(Cmode *cmode) } cmode->flag = '\0'; + extcmode_para_delslot(cmode, cmode->slot); } void CmodeDel(Cmode *cmode)