Merge pull request #65 from ff-meli/plugin_dispose_fix

fix race condition with plugin render vs dispose, on Dalamud dispose
This commit is contained in:
goaaats 2020-03-29 04:53:30 +09:00 committed by GitHub
commit 4d18a063f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,6 +135,12 @@ namespace Dalamud {
}
public void Dispose() {
// this must be done before unloading plugins, or it can cause a race condition
// due to rendering happening on another thread, where a plugin might receive
// a render call after it has been disposed, which can crash if it attempts to
// use any resources that it freed in its own Dispose method
this.InterfaceManager.Dispose();
try
{
this.PluginManager.UnloadPlugins();
@ -146,8 +152,6 @@ namespace Dalamud {
Log.Error(ex, "Plugin unload failed.");
}
this.InterfaceManager.Dispose();
this.Framework.Dispose();
this.ClientState.Dispose();