Ensure that Unix wxJoystick closes the associated device.

Close the device file descriptor in the dtor instead of doing it in the thread
used to poll it, this is more straightforward and ensures that it happens even
if the thread failed to run for whatever reason.
This commit is contained in:
Vadim Zeitlin
2015-05-24 02:55:16 +02:00
parent b6e5a0a679
commit 7e215ee069

View File

@@ -192,7 +192,6 @@ void* wxJoystickThread::Entry()
}
}
close(m_device);
return NULL;
}
@@ -231,7 +230,8 @@ wxJoystick::~wxJoystick()
ReleaseCapture();
if (m_thread)
m_thread->Delete(); // It's detached so it will delete itself
m_device = -1;
if (m_device != -1)
close(m_device);
}