Skip to content

Commit

Permalink
fixed crash when unloading plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mrDIMAS committed May 14, 2024
1 parent 40de0ff commit 1d3bac5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fyrox-impl/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,12 @@ impl Engine {
"Plugin {plugin_index} was serialized successfully!"
));

// Explicitly drop the visitor to prevent any destructors from the previous version of
// the plugin to run at the end of the scope. This could happen, because the visitor
// manages serialized smart pointers and if they'll be kept alive longer than the plugin
// there's a very high chance of hard crash.
drop(visitor);

*state = DynamicPluginState::Unloaded {
binary_blob: binary_blob.into_inner(),
};
Expand Down

0 comments on commit 1d3bac5

Please sign in to comment.