mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
[PR #790] Fix a crash when changing controller backends as rumble changes #125
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/stenzek/duckstation/pull/790
State: closed
Merged: No
This PR promotes
m_controller_interfacefromstd::unique_ptrtostd::shared_ptrto 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