Index: trunk/src/hid/common/actions.c =================================================================== --- trunk/src/hid/common/actions.c (revision 1249) +++ trunk/src/hid/common/actions.c (revision 1250) @@ -103,6 +103,7 @@ for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { hid_cookie_action_t *ca = e->value; if (ca->cookie == cookie) { + htsp_pop(all_actions, e->key); free(e->key); free(e->value); } @@ -418,7 +419,30 @@ return hid_parse_actionstring(str_, TRUE); } +void hid_actions_init(void) +{ +} + +void hid_actions_uninit(void) +{ + htsp_entry_t *e; + + if (all_actions == NULL) + return; + + for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { + hid_cookie_action_t *ca = e->value; + if (ca->cookie != NULL) + fprintf(stderr, "WARNING: hid_actions_uninit: action '%s' with cookie %p left registered, check your plugins!\n", e->key, ca->cookie); + free(e->key); + free(e->value); + } + + htsp_free(all_actions); + all_actions = NULL; +} + /* trick for the doc extractor */ #define static Index: trunk/src/hid/common/hidinit.c =================================================================== --- trunk/src/hid/common/hidinit.c (revision 1249) +++ trunk/src/hid/common/hidinit.c (revision 1250) @@ -113,6 +113,8 @@ void hid_init() { + hid_actions_init(); + /* Setup a "nogui" default HID */ gui = hid_nogui_get_hid(); @@ -136,7 +138,7 @@ void hid_uninit(void) { - + hid_actions_uninit(); } void hid_register_hid(HID * hid) Index: trunk/src/hid.h =================================================================== --- trunk/src/hid.h (revision 1249) +++ trunk/src/hid.h (revision 1250) @@ -644,6 +644,10 @@ smaller than a screen pixel. */ extern int pixel_slop; +/* Init and uninit the whole action framework */ + void hid_actions_init(void); + void hid_actions_uninit(void); + #if defined(__cplusplus) && __cplusplus } #endif Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 1249) +++ trunk/src/main.c (revision 1250) @@ -1573,8 +1573,6 @@ if (gui->uninit != NULL) gui->uninit(gui); - hid_uninit(); - UninitBuffers(); /* Free up memory allocated to the PCB. Why bother when we're about to exit ? @@ -1587,6 +1585,7 @@ plugins_uninit(); events_uninit(); + hid_uninit(); for (i = 0; i < MAX_LAYER; i++) free(Settings.DefaultLayerName[i]);