From 01a224425d2a90e660bbfffe8d1cbc6b93da24bd Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 27 Jan 2025 16:56:15 -0500 Subject: Fix some rust race conditions and comment some likely suspects FYI The binary view saving stuff can deadlock right now, so we document that now :/ --- rust/tests/binary_view.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rust/tests/binary_view.rs') diff --git a/rust/tests/binary_view.rs b/rust/tests/binary_view.rs index 65f6b45b..0ee10d87 100644 --- a/rust/tests/binary_view.rs +++ b/rust/tests/binary_view.rs @@ -3,6 +3,7 @@ use binaryninja::headless::Session; use binaryninja::symbol::{SymbolBuilder, SymbolType}; use rstest::*; use std::path::PathBuf; +use binaryninja::main_thread::execute_on_main_thread_and_wait; #[fixture] #[once] @@ -31,6 +32,10 @@ fn test_binary_saving(_session: &Session) { // Verify that we modified the binary let modified_contents = view.read_vec(0x1560, 4); assert_eq!(modified_contents, [0xff, 0xff, 0xff, 0xff]); + + // HACK: To prevent us from deadlocking in save_to_path we wait for all main thread actions to finish. + execute_on_main_thread_and_wait(|| {}); + // Save the modified file assert!(view.save_to_path(out_dir.join("atox.obj.new"))); // Verify that the file exists and is modified. -- cgit v1.3.1