fixed asserts on closing imgui file dialog

This commit is contained in:
MgAl2O4 2021-09-24 14:26:31 -04:00
parent 7f6f1d35d8
commit 5adc4de71f

View file

@ -50,14 +50,16 @@ namespace Dalamud.Interface.ImGuiFileDialog
windowVisible = ImGui.Begin(name, ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoNav); windowVisible = ImGui.Begin(name, ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoNav);
} }
bool wasClosed = false;
if (windowVisible) if (windowVisible)
{ {
if (!this.visible) if (!this.visible)
{ // window closed { // window closed
this.isOk = false; this.isOk = false;
return true; wasClosed = true;
} }
else
{
if (this.selectedFilter.Empty() && (this.filters.Count > 0)) if (this.selectedFilter.Empty() && (this.filters.Count > 0))
{ {
this.selectedFilter = this.filters[0]; this.selectedFilter = this.filters[0];
@ -81,6 +83,7 @@ namespace Dalamud.Interface.ImGuiFileDialog
this.DrawHeader(); this.DrawHeader();
this.DrawContent(); this.DrawContent();
res = this.DrawFooter(); res = this.DrawFooter();
}
if (this.isModal && !this.okResultToConfirm) if (this.isModal && !this.okResultToConfirm)
{ {
@ -93,7 +96,7 @@ namespace Dalamud.Interface.ImGuiFileDialog
ImGui.End(); ImGui.End();
} }
return this.ConfirmOrOpenOverWriteFileDialogIfNeeded(res); return wasClosed || this.ConfirmOrOpenOverWriteFileDialogIfNeeded(res);
} }
private static void AddToIconMap(string[] extensions, char icon, Vector4 color) private static void AddToIconMap(string[] extensions, char icon, Vector4 color)