Fix segfault when multiple controllers connected

This commit is contained in:
loki-47-6F-64 2021-09-27 19:35:06 +02:00
parent 4177b02064
commit 1f7bdb1b2a

View File

@ -696,7 +696,13 @@ public:
};
inline void rumbleIterate(std::vector<effect_t> &effects, std::vector<pollfd_t> &polls, std::chrono::milliseconds to) {
auto res = poll(&polls.data()->el, polls.size(), to.count());
std::vector<pollfd> polls_tmp;
polls_tmp.reserve(polls.size());
for(auto &poll : polls) {
polls_tmp.emplace_back(poll.el);
}
auto res = poll(polls_tmp.data(), polls.size(), to.count());
// If timed out
if(!res) {
@ -871,7 +877,7 @@ void broadcastRumble(safe::queue_t<mail_evdev_t> &rumble_queue_queue) {
}
if(polls.empty()) {
std::this_thread::sleep_for(50ms);
std::this_thread::sleep_for(250ms);
}
else {
rumbleIterate(effects, polls, 100ms);