diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 99b1c08e5..3ed3b2ef8 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -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();