Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JniWrapperCache: prevent double removal of entry from cache
When garbage collector clears the reference and we identify it in 'JniWrapperCache::cache_wrapper_impl()' we remove the entry from cache. This ensures, that references are not leaked in 'convert_to_jni()' function. However, this removal of entry from cache had very bad consequence. For the already cleared object disposal of cached entry can be scheduled after new entry for the same pointer is added to cache. In such situation the disposal scheduled for old object removed entry related to new object. In order to prevent that a counter was introduced. The last scheduled removal from cache erases the entry -- the remaining ones do not do anything. Signed-off-by: Patryk Wrobel <[email protected]>
- Loading branch information