@@ -18,12 +18,12 @@ use crate::rc::*;
18
18
use crate :: string:: * ;
19
19
use binaryninjacore_sys:: {
20
20
BNBeginUndoActions , BNCloseFile , BNCommitUndoActions , BNCreateDatabase , BNCreateFileMetadata ,
21
- BNFileMetadata , BNFileMetadataGetSessionId , BNFreeFileMetadata , BNGetCurrentOffset ,
22
- BNGetCurrentView , BNGetExistingViews , BNGetFileMetadataDatabase , BNGetFileViewOfType ,
23
- BNGetFilename , BNGetProjectFile , BNIsAnalysisChanged , BNIsBackedByDatabase , BNIsFileModified ,
24
- BNMarkFileModified , BNMarkFileSaved , BNNavigate , BNNewFileReference ,
25
- BNOpenDatabaseForConfiguration , BNOpenExistingDatabase , BNRedo , BNRevertUndoActions ,
26
- BNSaveAutoSnapshot , BNSetFilename , BNUndo ,
21
+ BNFileMetadata , BNFileMetadataGetSessionId , BNForgetUndoActions , BNFreeFileMetadata ,
22
+ BNGetCurrentOffset , BNGetCurrentView , BNGetExistingViews , BNGetFileMetadataDatabase ,
23
+ BNGetFileViewOfType , BNGetFilename , BNGetProjectFile , BNIsAnalysisChanged ,
24
+ BNIsBackedByDatabase , BNIsFileModified , BNMarkFileModified , BNMarkFileSaved , BNNavigate ,
25
+ BNNewFileReference , BNOpenDatabaseForConfiguration , BNOpenExistingDatabase , BNRedo ,
26
+ BNRevertUndoActions , BNSaveAutoSnapshot , BNSetFilename , BNUndo ,
27
27
} ;
28
28
use binaryninjacore_sys:: { BNCreateDatabaseWithProgress , BNOpenExistingDatabaseWithProgress } ;
29
29
use std:: ffi:: c_void;
@@ -180,6 +180,20 @@ impl FileMetadata {
180
180
}
181
181
}
182
182
183
+ /// Forgets the undo actions committed in the undo entry.
184
+ ///
185
+ /// NOTE: This is **NOT** thread safe, if you are holding any locks that might be held by both the main thread
186
+ /// and the thread executing this function, you can deadlock. You should also never call this function
187
+ /// on multiple threads at a time. See the following issues:
188
+ /// - <https://github.com/Vector35/binaryninja-api/issues/6289>
189
+ /// - <https://github.com/Vector35/binaryninja-api/issues/6325>
190
+ pub fn forget_undo_actions ( & self , id : & str ) {
191
+ let id = id. to_cstr ( ) ;
192
+ unsafe {
193
+ BNForgetUndoActions ( self . handle , id. as_ref ( ) . as_ptr ( ) as * const _ ) ;
194
+ }
195
+ }
196
+
183
197
pub fn undo ( & self ) {
184
198
unsafe {
185
199
BNUndo ( self . handle ) ;
0 commit comments