joystickstatuswindow: don't update accel/gyro if closed - #1229
Conversation
|
Currently, this only fixes the issue if the |
|
This was an attempt to fix #1230 but it does not fix the case where the close box is clicked. |
|
I wish Qt would not repaint an object if it didn't exist, but I can't seem to find a way of testing whether an object exists prior to calling |
|
Hello @xobs , Could you fix formatting in this PR? |
cf993d3 to
a18ce17
Compare
|
Of course. It didn't sit right with me that the fix was only partially successful, so I wanted to come up with a more complete fix. This should now work for both the case where the user clicks the close box on the window decoration, as well as the user clicking the "Close" button. It should also still work for devices with no sensors. The difference was to delete the whole QDialog box (which will cause it to close), but defer the deletion until the end of the runloop. That way the gyro and accel labels can still be updated, even if the window is closed while the values are getting updated. I have only tested it under Wayland. |
Defer deleting the window when it's closed until after the main loop has run. This prevents a segfault when the window is closed for controllers with accelerometers and gyroscopes, such as DualSense controllers. Signed-off-by: Sean Cross <sean@xobs.io>
a18ce17 to
f8388ec
Compare
|
Thank you for your contribution. :) |
Avoid updating the accelerometer or gyroscope values if the window is closed. This prevents a segfault when the window is closed for controllers with accelerometers and gyroscopes, such as DualSense controllers.