fix mac disconnection crash due to asynchronous operations

This commit is contained in:
Lysann Schlegel
2012-11-11 18:44:31 +01:00
parent 9892efab93
commit 3b1d440f03
4 changed files with 88 additions and 22 deletions

View File

@@ -85,6 +85,7 @@ void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes) {
for (; i < wiimotes; ++i) {
wiiuse_disconnect(wm[i]);
wiiuse_cleanup_platform_fields(wm[i]);
free(wm[i]);
}
@@ -177,8 +178,6 @@ void wiiuse_disconnected(struct wiimote_t* wm) {
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_CONNECTED);
/* reset a bunch of stuff */
wiiuse_cleanup_platform_fields(wm);
wm->leds = 0;
wm->state = WIIMOTE_INIT_STATES;
wm->read_req = NULL;