[PR #790] Fix a crash when changing controller backends as rumble changes #125

Open
opened 2026-01-29 19:06:31 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/stenzek/duckstation/pull/790

State: closed
Merged: No


This PR promotes m_controller_interface from std::unique_ptr to std::shared_ptr to allow the rumble update callback not to call back to the interface if it has expired by holding onto a weak pointer.

This fixes a crash when changing controller backends as rumble is being updated. Rumble update callback attempted to call to a destroyed class, causing a crash. By holding onto a weak pointer instead, the callback can attempt to lock the weak pointer and gracefully handle failure.

Fixes #784

**Original Pull Request:** https://github.com/stenzek/duckstation/pull/790 **State:** closed **Merged:** No --- This PR promotes `m_controller_interface` from `std::unique_ptr` to `std::shared_ptr` to allow the rumble update callback not to call back to the interface if it has expired by holding onto a weak pointer. This fixes a crash when changing controller backends as rumble is being updated. Rumble update callback attempted to call to a destroyed class, causing a crash. By holding onto a weak pointer instead, the callback can attempt to lock the weak pointer and gracefully handle failure. Fixes #784
claunia added the pull-request label 2026-01-29 19:06:31 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#125