From 8210d6ed685415cfc545d66166d008377792fb1a Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 12 Oct 2020 21:58:20 -0400 Subject: Fix stale references when modifying in place --- mediumlevelilinstruction.cpp | 12 ------------ mediumlevelilinstruction.h | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/mediumlevelilinstruction.cpp b/mediumlevelilinstruction.cpp index 3d90d7d2..b535ef5a 100644 --- a/mediumlevelilinstruction.cpp +++ b/mediumlevelilinstruction.cpp @@ -380,11 +380,7 @@ MediumLevelILIntegerList::ListIterator& MediumLevelILIntegerList::ListIterator:: if (operand >= 4) { operand = 0; -#ifdef BINARYNINJACORE_LIBRARY - instr = &function->GetRawExpr((size_t)instr->operands[4]); -#else instr = function->GetRawExpr((size_t)instr.operands[4]); -#endif } return *this; } @@ -392,11 +388,7 @@ MediumLevelILIntegerList::ListIterator& MediumLevelILIntegerList::ListIterator:: uint64_t MediumLevelILIntegerList::ListIterator::operator*() { -#ifdef BINARYNINJACORE_LIBRARY - return instr->operands[operand]; -#else return instr.operands[operand]; -#endif } @@ -404,11 +396,7 @@ MediumLevelILIntegerList::MediumLevelILIntegerList(MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count) { m_start.function = func; -#ifdef BINARYNINJACORE_LIBRARY - m_start.instr = &instr; -#else m_start.instr = instr; -#endif m_start.operand = 0; m_start.count = count; } diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h index 42567834..0cd8fde9 100644 --- a/mediumlevelilinstruction.h +++ b/mediumlevelilinstruction.h @@ -203,11 +203,10 @@ namespace BinaryNinja { #ifdef BINARYNINJACORE_LIBRARY MediumLevelILFunction* function; - const BNMediumLevelILInstruction* instr; #else Ref function; - BNMediumLevelILInstruction instr; #endif + BNMediumLevelILInstruction instr; size_t operand, count; bool operator==(const ListIterator& a) const; -- cgit v1.3.1