From bfa237397db04bb7b12a2803a12987c8dda2b316 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 4 Jul 2016 20:34:11 -0400 Subject: [PATCH] Settled on assigning to `nullptr` as the appropriate style for emptying shared_ptrs; fixed the Vic properly to release its output resources. --- Machines/Atari2600/Atari2600.cpp | 2 +- Machines/Vic-20/Vic20.cpp | 5 +++++ Machines/Vic-20/Vic20.hpp | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index 0ff4a2ed5..5baa9daee 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -100,7 +100,7 @@ void Machine::switch_region() void Machine::close_output() { - _crt.reset(); + _crt = nullptr; } Machine::~Machine() diff --git a/Machines/Vic-20/Vic20.cpp b/Machines/Vic-20/Vic20.cpp index 9f9c2a86b..ca19e6c70 100644 --- a/Machines/Vic-20/Vic20.cpp +++ b/Machines/Vic-20/Vic20.cpp @@ -122,6 +122,11 @@ void Machine::setup_output(float aspect_ratio) _mos6560.reset(new MOS::MOS6560()); } +void Machine::close_output() +{ + _mos6560 = nullptr; +} + void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data) { uint8_t *target = nullptr; diff --git a/Machines/Vic-20/Vic20.hpp b/Machines/Vic-20/Vic20.hpp index 28b5d6926..a7dc1d692 100644 --- a/Machines/Vic-20/Vic20.hpp +++ b/Machines/Vic-20/Vic20.hpp @@ -167,7 +167,7 @@ class Machine: // to satisfy CRTMachine::Machine virtual void setup_output(float aspect_ratio); - virtual void close_output() {} + virtual void close_output(); virtual std::shared_ptr get_crt() { return _mos6560->get_crt(); } virtual std::shared_ptr get_speaker() { return _mos6560->get_speaker(); } virtual void run_for_cycles(int number_of_cycles) { CPU6502::Processor::run_for_cycles(number_of_cycles); }