From 540fca65afaff35343a938b86596b21f2e16b48d Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Fri, 28 Nov 2025 11:13:08 -0800 Subject: Introduce an RAII type for managing bulk symbol modifications Fixes https://github.com/Vector35/binaryninja-api/issues/7666. Correctly managing the state of bulk symbol modifications via `BeginBulkModifySymbols` / `EndBulkModifySymbols` is error-prone in the face of exceptions and early returns. Leaking a bulk symbol modification can leave the view in a state where no further changes to symbols will be applied. All users of the C++ API are encouraged to move from `BeginBulkModifySymbols` / `EndBulkModifySymbols` to the new `BulkSymbolModification` class. --- view/pe/peview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'view/pe/peview.cpp') diff --git a/view/pe/peview.cpp b/view/pe/peview.cpp index 8537a036..ffe9c91a 100644 --- a/view/pe/peview.cpp +++ b/view/pe/peview.cpp @@ -1307,7 +1307,8 @@ bool PEView::Init() } vector> relocs; - BeginBulkModifySymbols(); + + BulkSymbolModification bulkSymbolModification(this); m_symbolQueue = new SymbolQueue(); m_symExternMappingMetadata = new Metadata(KeyValueDataType); @@ -2582,7 +2583,7 @@ bool PEView::Init() delete m_symbolQueue; m_symbolQueue = nullptr; - EndBulkModifySymbols(); + bulkSymbolModification.End(); StoreMetadata("SymbolExternalLibraryMapping", m_symExternMappingMetadata, true); -- cgit v1.3.1