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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user