mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 14:58:32 +00:00
ControllerInterface: Switch to std::shared_ptr
Small cleanup by using std::shared_ptr and getting rid of ciface.Devices() which just returned the m_devices (which defeats the point of making m_devices protected). Incidentally, this should make the code safer when we have different threads accessing devices in the future (for hotplug?). A lot of code use Device references directly so there is no easy way to remove FindDevice() and make those unique_ptrs.
This commit is contained in:
parent
afa202738e
commit
8678133e87
18 changed files with 80 additions and 60 deletions
|
@ -68,18 +68,13 @@ void Init()
|
|||
// Unfortunately udev gives us no way to filter out the non event device interfaces.
|
||||
// So we open it and see if it works with evdev ioctls or not.
|
||||
std::string name = GetName(devnode);
|
||||
evdevDevice* input = new evdevDevice(devnode, name_counts[name]++);
|
||||
auto input = std::make_shared<evdevDevice>(devnode, name_counts[name]++);
|
||||
|
||||
if (input->IsInteresting())
|
||||
{
|
||||
g_controller_interface.AddDevice(input);
|
||||
g_controller_interface.AddDevice(std::move(input));
|
||||
num_controllers++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Either it wasn't a evdev device, or it didn't have at least 8 buttons or two axis.
|
||||
delete input;
|
||||
}
|
||||
}
|
||||
udev_device_unref(dev);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue