mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Corrects joystick memory leaks.
This commit is contained in:
parent
7aaf27389c
commit
18798c9886
@ -107,15 +107,15 @@ class ConcreteMachine:
|
||||
break;
|
||||
}
|
||||
|
||||
joysticks_.push_back(new Joystick(bus_.get(), 0, 0));
|
||||
joysticks_.push_back(new Joystick(bus_.get(), 4, 1));
|
||||
joysticks_.emplace_back(new Joystick(bus_.get(), 0, 0));
|
||||
joysticks_.emplace_back(new Joystick(bus_.get(), 4, 1));
|
||||
}
|
||||
|
||||
bool insert_media(const StaticAnalyser::Media &media) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<Inputs::Joystick *> &get_joysticks() override {
|
||||
std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() override {
|
||||
return joysticks_;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ class ConcreteMachine:
|
||||
} frame_records_[4];
|
||||
unsigned int frame_record_pointer_;
|
||||
bool is_ntsc_;
|
||||
std::vector<Inputs::Joystick *> joysticks_;
|
||||
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ class ConcreteMachine:
|
||||
set_region(NTSC);
|
||||
|
||||
// install a joystick
|
||||
joysticks_.push_back(new Joystick(*user_port_via_port_handler_, *keyboard_via_port_handler_));
|
||||
joysticks_.emplace_back(new Joystick(*user_port_via_port_handler_, *keyboard_via_port_handler_));
|
||||
}
|
||||
|
||||
~ConcreteMachine() {
|
||||
@ -383,7 +383,7 @@ class ConcreteMachine:
|
||||
keyboard_via_port_handler_->clear_all_keys();
|
||||
}
|
||||
|
||||
std::vector<Inputs::Joystick *> &get_joysticks() override {
|
||||
std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() override {
|
||||
return joysticks_;
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ class ConcreteMachine:
|
||||
|
||||
Region region_;
|
||||
Commodore::Vic20::KeyboardMapper keyboard_mapper_;
|
||||
std::vector<Inputs::Joystick *> joysticks_;
|
||||
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
|
||||
|
||||
std::unique_ptr<Vic6560> mos6560_;
|
||||
std::shared_ptr<UserPortVIA> user_port_via_port_handler_;
|
||||
|
@ -16,7 +16,7 @@ namespace JoystickMachine {
|
||||
|
||||
class Machine {
|
||||
public:
|
||||
virtual std::vector<Inputs::Joystick *> &get_joysticks() = 0;
|
||||
virtual std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user