Index: trunk/src/hid/common/flags.c =================================================================== --- trunk/src/hid/common/flags.c (revision 1273) +++ trunk/src/hid/common/flags.c (revision 1274) @@ -51,6 +51,22 @@ htsp_set(hid_flags, a->name, ha); } +void hid_remove_flags_by_cookie(const char *cookie) +{ + htsp_entry_t *e; + HID_FlagNode *ha; + + if (hid_flags == NULL) + return NULL; + + for(e = htsp_first(hid_flags); e; e = htsp_next(hid_flags, e)) { + ha = e->value; + if (ha->cookie == cookie) + htsp_pop(hid_flags, e->key); + } +} + + void hid_flags_uninit(void) { if (hid_flags != NULL) { Index: trunk/src/hid/common/hidinit.c =================================================================== --- trunk/src/hid/common/hidinit.c (revision 1273) +++ trunk/src/hid/common/hidinit.c (revision 1274) @@ -148,6 +148,7 @@ free(hid_list); hid_actions_uninit(); + hid_flags_uninit(); } void hid_register_hid(HID * hid) Index: trunk/src/hid.h =================================================================== --- trunk/src/hid.h (revision 1273) +++ trunk/src/hid.h (revision 1274) @@ -144,6 +144,9 @@ #define REGISTER_FLAGS(a, cookie) HIDCONCAT(void register_,a) ()\ { hid_register_flags(a, sizeof(a)/sizeof(a[0]), cookie); } +/* Remove all flags matching a cookie */ + void hid_remove_flags_by_cookie(const char *cookie); + /* Looks up one of the flags registered above. If the flag is unknown, returns zero. */ int hid_get_flag(const char *name_); Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 1273) +++ trunk/src/main.c (revision 1274) @@ -1580,10 +1580,9 @@ free(PCB); PCB = NULL; + plugins_uninit(); hid_uninit(); - plugins_uninit(); events_uninit(); - hid_flags_uninit(); for (i = 0; i < MAX_LAYER; i++) free(Settings.DefaultLayerName[i]);