Some facts about Winmote and the crashing bug
Von FunnyDingo | 18. Mai 2008, 21:50
On the Wiimote project page I wrote about the small bug in the Winamp plugin Winmote: if a Wiimote is connect and you close Winamp, it crashes. My first idea: the Wiimote isn't disconnected properly. The Winamp API defines a "quit" function. This is a function provided by the plugin and called by Winamp if it should close. In this function I placed this code (I know, not nice, but for testing it's ok):
-
void quit()
-
{
-
while (wiimoteHandler->IsConnected())
-
{
-
wiimoteHandler->Disconnect();
-
}
-
}
WInamp close but crashes also. So, the Wiimote is disconnected. Here my next test (I know, very stupid, but testing...):
-
void quit()
-
{
-
wiimote->Disconnect();
-
MessageBox(NULL, "Wiimote disconnected", PLUGIN_NAME, MB_OK);
-
}
This works. After click OK in the message box, Winamp closes normaly. But what is the problem? I checked out the code of the library and saw, that a method of it is threaded. My idea: closing Winamp and stoping the thread wich reads the data from the Wiimote conflicts in some way. If you use the MessageBox() the system has enough time to end thread.
Maybe someone has another idea?
PS: Sorry for bad code formating, but the plugin is new to me and I think there are some problems with wordpress for saving nbsp's. Also the plugin has a problem with some chars like >...