fix race condition with plugin render vs dispose, on Dalamud dispose. Mainly seen in crashes when using /xldclose with plugin ui open

This commit is contained in:
meli 2020-03-28 12:45:13 -07:00
parent 68af40d9fc
commit e00a02bdee

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();