From 6906d146bbcd0118aa0686a04eb34cd6f6a57f31 Mon Sep 17 00:00:00 2001 From: Fabian Schaffert Date: Sat, 15 Nov 2014 00:16:17 +0100 Subject: [PATCH] Adds copy constructor for class InstrBase A copy constructor is necessarry for `class InstrBase`, as the implicit copy constructor simply copies the pointer `m_args`. This results in a double delete of the same memory region, causing a segmentation fault when rpcs3 exited. --- rpcs3/Emu/CPU/CPUDecoder.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rpcs3/Emu/CPU/CPUDecoder.h b/rpcs3/Emu/CPU/CPUDecoder.h index df28e54467..d1faeea13d 100644 --- a/rpcs3/Emu/CPU/CPUDecoder.h +++ b/rpcs3/Emu/CPU/CPUDecoder.h @@ -333,6 +333,17 @@ public: }); } + InstrBase(const InstrBase &source) + : InstrCaller(source) + , m_name(source.m_name) + , m_opcode(source.m_opcode) + , m_args_count(source.m_args_count) + , m_args(source.m_args_count ? new CodeFieldBase*[source.m_args_count] : nullptr) + { + for(int i = 0; i < source.m_args_count; ++i) + m_args[i] = source.m_args[i]; + } + virtual ~InstrBase() { if (m_args) {