diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2023-02-09 16:52:36 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2023-02-09 18:28:46 -0500 |
| commit | e71d12a6147d0a2dfe6ead94d31db30d36792087 (patch) | |
| tree | f053ad326cc06e46a4996a1a45b7dba35d85c801 /binaryninjaapi.h | |
| parent | 4f249cc20079752818605badd364d102cd597231 (diff) | |
Fix crash caused by race condition on freeing plugin BinaryViews
`FreeObjectReference` on `BinaryView` can be deferred to not block the
UI on teardown of large binary views. This causes
`ReleaseForRegistration` to be called at a later time, which could cause
a race that permitted two threads to delete the object at the same time.
Moving the `FreeObjectReference` to be after the API reference release
causes `ReleaseForRegistration` to be always called after all API
references have been completed, so it will no longer free twice.
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index a5ad242d..c5724621 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -165,9 +165,10 @@ namespace BinaryNinja { void Release() { - if (m_object) - FreeObjectReference(m_object); + T* obj = m_object; ReleaseInternal(); + if (obj) + FreeObjectReference(obj); } void AddRefForRegistration() { m_registeredRef = true; } |
