diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp index 5c12ff92f..d2557968a 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp @@ -10,12 +10,12 @@ using namespace Analyser::Dynamic; -MultiKeyboardMachine::MultiKeyboardMachine(const std::vector> &machines) : - keyboard_(machines_) { +MultiKeyboardMachine::MultiKeyboardMachine(const std::vector> &machines) { for(const auto &machine: machines) { auto keyboard_machine = machine->keyboard_machine(); if(keyboard_machine) machines_.push_back(keyboard_machine); } + keyboard_ = std::make_unique(machines_); } void MultiKeyboardMachine::clear_all_keys() { @@ -45,7 +45,7 @@ bool MultiKeyboardMachine::can_type(char c) const { } Inputs::Keyboard &MultiKeyboardMachine::get_keyboard() { - return keyboard_; + return *keyboard_; } MultiKeyboardMachine::MultiKeyboard::MultiKeyboard(const std::vector<::MachineTypes::KeyboardMachine *> &machines) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp index aa5433563..2de296456 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp @@ -42,7 +42,7 @@ class MultiKeyboardMachine: public MachineTypes::KeyboardMachine { std::set observed_keys_; bool is_exclusive_ = false; }; - MultiKeyboard keyboard_; + std::unique_ptr keyboard_; public: MultiKeyboardMachine(const std::vector> &machines);