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

@@ -149,13 +149,14 @@ int wiiuse_os_poll(struct wiimote_t** wm, int wiimotes) {
if (wiiuse_os_read(wm[i])) {
/* propagate the event, messages should be read as in linux, starting from the second element */
propagate_event(wm[i], wm[i]->event_buf[1], wm[i]->event_buf+2);
evnt += (wm[i]->event != WIIUSE_NONE);
/* clear out the event buffer */
memset(wm[i]->event_buf, 0, sizeof(wm[i]->event_buf));
} else {
idle_cycle(wm[i]);
}
evnt += (wm[i]->event != WIIUSE_NONE);
}
return evnt;