From afe58dae765253261c79b46fb1e2335cb5f325aa Mon Sep 17 00:00:00 2001 From: Soreepeong <3614868+Soreepeong@users.noreply.github.com> Date: Fri, 8 Aug 2025 21:27:40 +0900 Subject: [PATCH] Make ImU8String not IDisposable --- Dalamud/Interface/Utility/ImGuiHelpers.cs | 4 +- .../Custom/ImGui.ColorEditPicker.cs | 12 +- .../Custom/ImGui.ComboAndList.cs | 34 ++--- .../Custom/ImGui.DragScalar.cs | 28 ++-- .../Custom/ImGui.InputScalar.cs | 16 +-- .../Custom/ImGui.Manual.cs | 56 ++++---- .../Custom/ImGui.Misc.cs | 12 +- .../Custom/ImGui.Plot.cs | 32 ++--- .../Custom/ImGui.SliderScalar.cs | 24 ++-- .../Custom/ImGui.Text.cs | 62 ++++----- .../Custom/ImGui.Widgets.cs | 128 +++++++++--------- .../Custom/ImGuiP.Misc.cs | 88 ++++++------ .../Custom/ImGuiP.Plot.cs | 12 +- .../Custom/ImGuiP.Text.cs | 20 +-- imgui/Dalamud.Bindings.ImGui/ImU8String.cs | 6 +- 15 files changed, 267 insertions(+), 267 deletions(-) diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs index 27cb3596c..87f258250 100644 --- a/Dalamud/Interface/Utility/ImGuiHelpers.cs +++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs @@ -203,8 +203,8 @@ public static partial class ImGuiHelpers ImGui.SetClipboardText(textCopy.IsNull ? text.Span : textCopy.Span); } - text.Dispose(); - textCopy.Dispose(); + text.Recycle(); + textCopy.Recycle(); } /// Draws a SeString. diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ColorEditPicker.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ColorEditPicker.cs index 655083627..9cfdd970c 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ColorEditPicker.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ColorEditPicker.cs @@ -13,7 +13,7 @@ public static unsafe partial class ImGui fixed (Vector3* colPtr = &col) { var res = ImGuiNative.ColorEdit3(labelPtr, &colPtr->X, flags) != 0; - label.Dispose(); + label.Recycle(); return res; } } @@ -25,7 +25,7 @@ public static unsafe partial class ImGui fixed (Vector4* colPtr = &col) { var res = ImGuiNative.ColorEdit4(labelPtr, &colPtr->X, flags) != 0; - label.Dispose(); + label.Recycle(); return res; } } @@ -37,7 +37,7 @@ public static unsafe partial class ImGui fixed (Vector3* colPtr = &col) { var res = ImGuiNative.ColorPicker3(labelPtr, &colPtr->X, flags) != 0; - label.Dispose(); + label.Recycle(); return res; } } @@ -49,7 +49,7 @@ public static unsafe partial class ImGui fixed (Vector4* colPtr = &col) { var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, flags, null) != 0; - label.Dispose(); + label.Recycle(); return res; } } @@ -62,7 +62,7 @@ public static unsafe partial class ImGui fixed (Vector4* refColPtr = &refCol) { var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, flags, &refColPtr->X) != 0; - label.Dispose(); + label.Recycle(); return res; } } @@ -74,7 +74,7 @@ public static unsafe partial class ImGui fixed (Vector4* refColPtr = &refCol) { var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, ImGuiColorEditFlags.None, &refColPtr->X) != 0; - label.Dispose(); + label.Recycle(); return res; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ComboAndList.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ComboAndList.cs index 5b917bd48..ed261a694 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ComboAndList.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.ComboAndList.cs @@ -27,8 +27,8 @@ public static unsafe partial class ImGui fixed (byte* itemsSeparatedByZerosPtr = itemsSeparatedByZeros) { var r = ImGuiNative.Combo(labelPtr, currentItemPtr, itemsSeparatedByZerosPtr, popupMaxHeightInItems) != 0; - label.Dispose(); - itemsSeparatedByZeros.Dispose(); + label.Recycle(); + itemsSeparatedByZeros.Recycle(); return r; } } @@ -129,8 +129,8 @@ public static unsafe partial class ImGui &dataBuffer, itemsCount, popupMaxHeightInItems) != 0; - label.Dispose(); - textBuffer.Dispose(); + label.Recycle(); + textBuffer.Recycle(); return r; } } @@ -156,8 +156,8 @@ public static unsafe partial class ImGui &dataBuffer, itemsCount, popupMaxHeightInItems) != 0; - label.Dispose(); - textBuffer.Dispose(); + label.Recycle(); + textBuffer.Recycle(); return r; } } @@ -181,8 +181,8 @@ public static unsafe partial class ImGui &dataBuffer, itemsCount, popupMaxHeightInItems) != 0; - label.Dispose(); - textBuffer.Dispose(); + label.Recycle(); + textBuffer.Recycle(); return r; } } @@ -282,8 +282,8 @@ public static unsafe partial class ImGui &dataBuffer, itemsCount, heightInItems) != 0; - label.Dispose(); - textBuffer.Dispose(); + label.Recycle(); + textBuffer.Recycle(); return r; } } @@ -309,8 +309,8 @@ public static unsafe partial class ImGui &dataBuffer, itemsCount, heightInItems) != 0; - label.Dispose(); - textBuffer.Dispose(); + label.Recycle(); + textBuffer.Recycle(); return r; } } @@ -334,8 +334,8 @@ public static unsafe partial class ImGui &dataBuffer, itemsCount, heightInItems) != 0; - label.Dispose(); - textBuffer.Dispose(); + label.Recycle(); + textBuffer.Recycle(); return r; } } @@ -345,7 +345,7 @@ public static unsafe partial class ImGui { #pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ref var s = ref PointerTuple.From, ImU8String, object>(data); - s.Item2.Dispose(); + s.Item2.Recycle(); s.Item2 = s.Item1.Invoke(ref s.Item3, index); if (s.Item2.IsNull) return false; @@ -359,7 +359,7 @@ public static unsafe partial class ImGui { #pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ref var s = ref PointerTuple.From, ImU8String, object>(data); - s.Item2.Dispose(); + s.Item2.Recycle(); s.Item2 = s.Item1.Invoke(s.Item3, index); if (s.Item2.IsNull) return false; @@ -373,7 +373,7 @@ public static unsafe partial class ImGui { #pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ref var s = ref PointerTuple.From(data); - s.Item2.Dispose(); + s.Item2.Recycle(); s.Item2 = s.Item1.Invoke(index); if (s.Item2.IsNull) return false; diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.DragScalar.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.DragScalar.cs index 13c06ad2b..665fa434f 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.DragScalar.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.DragScalar.cs @@ -309,8 +309,8 @@ public static unsafe partial class ImGui fixed (T* vMaxPtr = &vMax) { var res = ImGuiNative.DragScalar(labelPtr, dataType, vPtr, vSpeed, vMinPtr, vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -336,8 +336,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -362,8 +362,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -389,8 +389,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -418,9 +418,9 @@ public static unsafe partial class ImGui formatPtr, formatMaxPtr, flags); - label.Dispose(); - format.Dispose(); - formatMax.Dispose(); + label.Recycle(); + format.Recycle(); + formatMax.Recycle(); return res != 0; } } @@ -448,9 +448,9 @@ public static unsafe partial class ImGui formatPtr, formatMaxPtr, flags); - label.Dispose(); - format.Dispose(); - formatMax.Dispose(); + label.Recycle(); + format.Recycle(); + formatMax.Recycle(); return res != 0; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.InputScalar.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.InputScalar.cs index 5f659a186..fb86096ff 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.InputScalar.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.InputScalar.cs @@ -274,8 +274,8 @@ public static unsafe partial class ImGui stepFast > T.Zero ? stepFastPtr : null, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -302,8 +302,8 @@ public static unsafe partial class ImGui stepFast > T.Zero ? stepFastPtr : null, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -329,8 +329,8 @@ public static unsafe partial class ImGui stepFast > T.Zero ? stepFastPtr : null, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -357,8 +357,8 @@ public static unsafe partial class ImGui stepFast > T.Zero ? stepFastPtr : null, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Manual.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Manual.cs index c9114f0f6..89b3cc3d6 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Manual.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Manual.cs @@ -26,7 +26,7 @@ public unsafe partial class ImGui fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) { var len = ImGuiNative.DataTypeFormatString(bufPtr, buf.Length, dataType, &data, formatPtr); - format.Dispose(); + format.Recycle(); return buf[..len]; } } @@ -39,7 +39,7 @@ public unsafe partial class ImGui fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) fixed (byte* bufPtr = buf) ImGuiNative.ImParseFormatTrimDecorations(formatPtr, bufPtr, (nuint)buf.Length); - format.Dispose(); + format.Recycle(); var nul = buf.IndexOf((byte)0); return nul == -1 ? buf : buf[..nul]; } @@ -129,7 +129,7 @@ public unsafe partial class ImGui var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -142,7 +142,7 @@ public unsafe partial class ImGui var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -155,7 +155,7 @@ public unsafe partial class ImGui var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback, ref context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -168,7 +168,7 @@ public unsafe partial class ImGui var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback, in context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -192,8 +192,8 @@ public unsafe partial class ImGui flags, callback == null ? null : &InputTextCallbackStatic, callback == null ? null : &dataBuffer) != 0; - label.Dispose(); - hint.Dispose(); + label.Recycle(); + hint.Recycle(); return r; } } @@ -218,8 +218,8 @@ public unsafe partial class ImGui flags, callback == null ? null : &InputTextCallbackPtrStatic, callback == null ? null : &dataBuffer) != 0; - label.Dispose(); - hint.Dispose(); + label.Recycle(); + hint.Recycle(); return r; } } @@ -245,8 +245,8 @@ public unsafe partial class ImGui flags, &InputTextCallbackRefContextStatic, &dataBuffer) != 0; - label.Dispose(); - hint.Dispose(); + label.Recycle(); + hint.Recycle(); return r; } } @@ -272,8 +272,8 @@ public unsafe partial class ImGui flags, &InputTextCallbackInContextStatic, &dataBuffer) != 0; - label.Dispose(); - hint.Dispose(); + label.Recycle(); + hint.Recycle(); return r; } } @@ -289,7 +289,7 @@ public unsafe partial class ImGui var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -302,7 +302,7 @@ public unsafe partial class ImGui var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -316,7 +316,7 @@ public unsafe partial class ImGui var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback, ref context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -330,7 +330,7 @@ public unsafe partial class ImGui var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback, in context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -390,7 +390,7 @@ public unsafe partial class ImGui var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -403,7 +403,7 @@ public unsafe partial class ImGui var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -416,7 +416,7 @@ public unsafe partial class ImGui var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback, ref context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -429,7 +429,7 @@ public unsafe partial class ImGui var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback, in context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -479,7 +479,7 @@ public unsafe partial class ImGui var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -492,7 +492,7 @@ public unsafe partial class ImGui var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -505,7 +505,7 @@ public unsafe partial class ImGui var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback, ref context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -518,7 +518,7 @@ public unsafe partial class ImGui var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback, in context); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } @@ -529,7 +529,7 @@ public unsafe partial class ImGui fixed (byte* bufPtr = buf) { var r = ImGuiNative.TempInputText(bb, id, labelPtr, bufPtr, buf.Length, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -543,7 +543,7 @@ public unsafe partial class ImGui var r = TempInputText(bb, id, label, t.Buffer[..(maxLength + 1)], flags); var i = t.Buffer.IndexOf((byte)0); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); - t.Dispose(); + t.Recycle(); return r; } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Misc.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Misc.cs index a77331dbc..e7aa6cc4a 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Misc.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Misc.cs @@ -27,7 +27,7 @@ public static unsafe partial class ImGui fixed (byte* typePtr = &type.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.AcceptDragDropPayload(typePtr, flags); - type.Dispose(); + type.Recycle(); return r; } } @@ -39,7 +39,7 @@ public static unsafe partial class ImGui fixed (byte* filenamePtr = &filename.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.AddFontFromFileTTF(self, filenamePtr, sizePixels, fontCfg, glyphRanges); - filename.Dispose(); + filename.Recycle(); return r; } } @@ -56,7 +56,7 @@ public static unsafe partial class ImGui sizePixels, fontCfg, glyphRanges); - compressedFontDatabase85.Dispose(); + compressedFontDatabase85.Recycle(); return r; } } @@ -96,7 +96,7 @@ public static unsafe partial class ImGui { fixed (byte* strPtr = &str.GetPinnableNullTerminatedReference()) ImGuiNative.AddInputCharactersUTF8(self.Handle, strPtr); - str.Dispose(); + str.Recycle(); } public static ref bool GetBoolRef(ImGuiStoragePtr self, uint key, bool defaultValue = false) => @@ -125,7 +125,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = strId) { var r = ImGuiNative.GetID(strIdPtr, strIdPtr + strId.Length); - strId.Dispose(); + strId.Recycle(); return r; } } @@ -139,7 +139,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = strId) { ImGuiNative.PushID(strIdPtr, strIdPtr + strId.Length); - strId.Dispose(); + strId.Recycle(); } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Plot.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Plot.cs index 69b3b7dbe..d2662238c 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Plot.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Plot.cs @@ -34,8 +34,8 @@ public static unsafe partial class ImGui stride); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotHistogram( @@ -66,8 +66,8 @@ public static unsafe partial class ImGui graphSize); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotHistogram( @@ -97,8 +97,8 @@ public static unsafe partial class ImGui graphSize); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotHistogram( @@ -126,8 +126,8 @@ public static unsafe partial class ImGui graphSize); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotLines( @@ -151,8 +151,8 @@ public static unsafe partial class ImGui stride); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotLines( @@ -182,8 +182,8 @@ public static unsafe partial class ImGui graphSize); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotLines( @@ -214,8 +214,8 @@ public static unsafe partial class ImGui graphSize); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } public static void PlotLines( @@ -243,8 +243,8 @@ public static unsafe partial class ImGui graphSize); } - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); } #pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.SliderScalar.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.SliderScalar.cs index e37eaec65..20ee78ab6 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.SliderScalar.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.SliderScalar.cs @@ -277,8 +277,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -305,8 +305,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -332,8 +332,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -360,8 +360,8 @@ public static unsafe partial class ImGui vMaxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -383,8 +383,8 @@ public static unsafe partial class ImGui vDegreesMax, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } @@ -466,8 +466,8 @@ public static unsafe partial class ImGui { var res = ImGuiNative.VSliderScalar(labelPtr, size, dataType, dataPtr, minPtr, maxPtr, formatPtr, flags) != 0; - label.Dispose(); - format.Dispose(); + label.Recycle(); + format.Recycle(); return res; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Text.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Text.cs index c4b542563..284475824 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Text.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Text.cs @@ -10,14 +10,14 @@ public static unsafe partial class ImGui { fixed (byte* textPtr = text) ImGuiNative.AddText(self.Handle, textPtr, textPtr + text.Length); - text.Dispose(); + text.Recycle(); } public static void AddText(ImDrawListPtr self, Vector2 pos, uint col, ImU8String text) { fixed (byte* textPtr = text) ImGuiNative.AddText(self.Handle, pos, col, textPtr, textPtr + text.Length); - text.Dispose(); + text.Recycle(); } public static void AddText( @@ -36,7 +36,7 @@ public static unsafe partial class ImGui textPtr + text.Length, wrapWidth, cpuFineClipRectPtr); - text.Dispose(); + text.Recycle(); } public static void AddText( @@ -45,14 +45,14 @@ public static unsafe partial class ImGui { fixed (byte* textPtr = text) ImGuiNative.AddText(self.Handle, font, fontSize, pos, col, textPtr, textPtr + text.Length, wrapWidth, null); - text.Dispose(); + text.Recycle(); } public static void append(this ImGuiTextBufferPtr self, ImU8String str) { fixed (byte* strPtr = str) ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length); - str.Dispose(); + str.Recycle(); } public static void BulletText(ImU8String text) @@ -92,7 +92,7 @@ public static unsafe partial class ImGui textPtr + text.Length, hideTextAfterDoubleHash ? (byte)1 : (byte)0, wrapWidth); - text.Dispose(); + text.Recycle(); return @out; } @@ -115,7 +115,7 @@ public static unsafe partial class ImGui remaining = (int)(remainingPtr - textPtr); } - text.Dispose(); + text.Recycle(); return @out; } @@ -126,7 +126,7 @@ public static unsafe partial class ImGui { var r = (int)(ImGuiNative.CalcWordWrapPositionA(font.Handle, scale, ptr, ptr + text.Length, wrapWidth) - ptr); - text.Dispose(); + text.Recycle(); return r; } } @@ -136,7 +136,7 @@ public static unsafe partial class ImGui { fixed (byte* ptr = text) ImGuiNative.InsertChars(self.Handle, pos, ptr, ptr + text.Length); - text.Dispose(); + text.Recycle(); } public static void LabelText( @@ -146,8 +146,8 @@ public static unsafe partial class ImGui var window = ImGuiP.GetCurrentWindow().Handle; if (window->SkipItems != 0) { - label.Dispose(); - text.Dispose(); + label.Recycle(); + text.Recycle(); return; } @@ -168,8 +168,8 @@ public static unsafe partial class ImGui ImGuiP.ItemSize(totalBb, style.FramePadding.Y); if (!ImGuiP.ItemAdd(totalBb, 0)) { - label.Dispose(); - text.Dispose(); + label.Recycle(); + text.Recycle(); return; } @@ -182,8 +182,8 @@ public static unsafe partial class ImGui label.Span); } - label.Dispose(); - text.Dispose(); + label.Recycle(); + text.Recycle(); } public static void LogText(ImU8String text) @@ -201,7 +201,7 @@ public static unsafe partial class ImGui append(&g.Handle->LogBuffer, text); } - text.Dispose(); + text.Recycle(); } public static bool PassFilter(ImGuiTextFilterPtr self, ImU8String text) @@ -209,7 +209,7 @@ public static unsafe partial class ImGui fixed (byte* textPtr = text) { var r = ImGuiNative.PassFilter(self.Handle, textPtr, textPtr + text.Length) != 0; - text.Dispose(); + text.Recycle(); return r; } } @@ -230,7 +230,7 @@ public static unsafe partial class ImGui textPtr + text.Length, wrapWidth, cpuFineClip ? (byte)1 : (byte)0); - text.Dispose(); + text.Recycle(); } public static void SetTooltip(ImU8String text) @@ -238,14 +238,14 @@ public static unsafe partial class ImGui ImGuiP.BeginTooltipEx(ImGuiTooltipFlags.OverridePreviousTooltip, ImGuiWindowFlags.None); Text(text.Span); EndTooltip(); - text.Dispose(); + text.Recycle(); } public static void Text(ImU8String text) { fixed (byte* ptr = text) ImGuiNative.TextUnformatted(ptr, ptr + text.Length); - text.Dispose(); + text.Recycle(); } public static void TextColored(uint col, ImU8String text) @@ -253,7 +253,7 @@ public static unsafe partial class ImGui PushStyleColor(ImGuiCol.Text, col); Text(text.Span); PopStyleColor(); - text.Dispose(); + text.Recycle(); } public static void TextColored(scoped in Vector4 col, ImU8String text) @@ -261,19 +261,19 @@ public static unsafe partial class ImGui PushStyleColor(ImGuiCol.Text, col); Text(text.Span); PopStyleColor(); - text.Dispose(); + text.Recycle(); } public static void TextDisabled(ImU8String text) { TextColored(*GetStyleColorVec4(ImGuiCol.TextDisabled), text.Span); - text.Dispose(); + text.Recycle(); } public static void TextUnformatted(ImU8String text) { Text(text.Span); - text.Dispose(); + text.Recycle(); } public static void TextWrapped(ImU8String text) @@ -285,7 +285,7 @@ public static unsafe partial class ImGui Text(text.Span); if (needBackup) PopTextWrapPos(); - text.Dispose(); + text.Recycle(); } public static void TextColoredWrapped(uint col, ImU8String text) @@ -293,7 +293,7 @@ public static unsafe partial class ImGui PushStyleColor(ImGuiCol.Text, col); TextWrapped(text.Span); PopStyleColor(); - text.Dispose(); + text.Recycle(); } public static void TextColoredWrapped(scoped in Vector4 col, ImU8String text) @@ -301,7 +301,7 @@ public static unsafe partial class ImGui PushStyleColor(ImGuiCol.Text, col); TextWrapped(text.Span); PopStyleColor(); - text.Dispose(); + text.Recycle(); } public static bool TreeNode(ImU8String label) @@ -309,7 +309,7 @@ public static unsafe partial class ImGui var window = ImGuiP.GetCurrentWindow(); if (window.SkipItems) { - label.Dispose(); + label.Recycle(); return false; } @@ -317,7 +317,7 @@ public static unsafe partial class ImGui window.Handle->GetID(label.Span), ImGuiTreeNodeFlags.None, label.Span[..ImGuiP.FindRenderedTextEnd(label.Span, out _, out _)]); - label.Dispose(); + label.Recycle(); return res; } @@ -343,8 +343,8 @@ public static unsafe partial class ImGui res = ImGuiP.TreeNodeBehavior(window.Handle->GetID(id.Span), flags, label.Span[..label.Length]); } - id.Dispose(); - label.Dispose(); + id.Recycle(); + label.Recycle(); return res; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Widgets.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Widgets.cs index 9cbc3dc9a..6e6bbacb4 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Widgets.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGui.Widgets.cs @@ -12,7 +12,7 @@ public static unsafe partial class ImGui fixed (bool* openPtr = &open) { var r = ImGuiNative.Begin(namePtr, openPtr, flags) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -22,7 +22,7 @@ public static unsafe partial class ImGui fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.Begin(namePtr, null, flags) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -33,7 +33,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginChild(strIdPtr, size, border ? (byte)1 : (byte)0, flags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -49,8 +49,8 @@ public static unsafe partial class ImGui fixed (byte* previewValuePtr = &previewValue.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginCombo(labelPtr, previewValuePtr, flags) != 0; - label.Dispose(); - previewValue.Dispose(); + label.Recycle(); + previewValue.Recycle(); return r; } } @@ -60,7 +60,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginListBox(labelPtr, size) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -70,7 +70,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginMenu(labelPtr, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -80,7 +80,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginPopup(strIdPtr, flags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -91,7 +91,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginPopupContextItem(strIdPtr, popupFlags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -102,7 +102,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginPopupContextWindow(strIdPtr, popupFlags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -113,7 +113,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginPopupContextVoid(strIdPtr, popupFlags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -125,7 +125,7 @@ public static unsafe partial class ImGui fixed (bool* openPtr = &open) { var r = ImGuiNative.BeginPopupModal(namePtr, openPtr, flags) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -135,7 +135,7 @@ public static unsafe partial class ImGui fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginPopupModal(namePtr, null, flags) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -145,7 +145,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginTabBar(strIdPtr, flags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -157,7 +157,7 @@ public static unsafe partial class ImGui fixed (bool* pOpenPtr = &pOpen) { var r = ImGuiNative.BeginTabItem(labelPtr, pOpenPtr, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -167,7 +167,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginTabItem(labelPtr, null, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -179,7 +179,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.BeginTable(strIdPtr, column, flags, outerSize, innerWidth) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -189,7 +189,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.Button(labelPtr, size) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -200,7 +200,7 @@ public static unsafe partial class ImGui fixed (bool* vPtr = &v) { var r = ImGuiNative.Checkbox(labelPtr, vPtr) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -234,7 +234,7 @@ public static unsafe partial class ImGui flags &= ~flagsValue; } - label.Dispose(); + label.Recycle(); return pressed; } } @@ -246,7 +246,7 @@ public static unsafe partial class ImGui fixed (bool* visiblePtr = &visible) { var r = ImGuiNative.CollapsingHeader(labelPtr, visiblePtr, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -256,7 +256,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.CollapsingHeader(labelPtr, null, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -268,7 +268,7 @@ public static unsafe partial class ImGui fixed (byte* descIdPtr = &descId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.ColorButton(descIdPtr, col, flags, size) != 0; - descId.Dispose(); + descId.Recycle(); return r; } } @@ -277,7 +277,7 @@ public static unsafe partial class ImGui { fixed (byte* idPtr = &id.GetPinnableNullTerminatedReference()) ImGuiNative.Columns(count, idPtr, border ? (byte)1 : (byte)0); - id.Dispose(); + id.Recycle(); } public static bool DebugCheckVersionAndDataLayout( @@ -294,7 +294,7 @@ public static unsafe partial class ImGui szVec4, szDrawVert, szDrawIdx) != 0; - versionStr.Dispose(); + versionStr.Recycle(); return r; } } @@ -304,7 +304,7 @@ public static unsafe partial class ImGui fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference()) { ImGuiNative.DebugTextEncoding(textPtr); - text.Dispose(); + text.Recycle(); } } @@ -313,7 +313,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference("Filter (inc,-exc)"u8)) { var r = ImGuiNative.Draw(self.Handle, labelPtr, width) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -323,7 +323,7 @@ public static unsafe partial class ImGui fixed (byte* defaultFilterPtr = &defaultFilter.GetPinnableNullTerminatedReference("\0"u8)) { var r = ImGuiNative.ImGuiTextFilter(defaultFilterPtr); - defaultFilter.Dispose(); + defaultFilter.Recycle(); return r; } } @@ -342,7 +342,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.InvisibleButton(strIdPtr, size, flags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -352,7 +352,7 @@ public static unsafe partial class ImGui fixed (byte* typePtr = &type.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.IsDataType(self.Handle, typePtr) != 0; - type.Dispose(); + type.Recycle(); return r; } } @@ -362,7 +362,7 @@ public static unsafe partial class ImGui fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.IsPopupOpen(strIdPtr, flags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -371,21 +371,21 @@ public static unsafe partial class ImGui { fixed (byte* iniFilenamePtr = &iniFilename.GetPinnableNullTerminatedReference()) ImGuiNative.LoadIniSettingsFromDisk(iniFilenamePtr); - iniFilename.Dispose(); + iniFilename.Recycle(); } public static void LoadIniSettingsFromMemory(ImU8String iniData) { fixed (byte* iniDataPtr = iniData) ImGuiNative.LoadIniSettingsFromMemory(iniDataPtr, (nuint)iniData.Length); - iniData.Dispose(); + iniData.Recycle(); } public static void LogToFile(int autoOpenDepth = -1, ImU8String filename = default) { fixed (byte* filenamePtr = &filename.GetPinnableNullTerminatedReference()) ImGuiNative.LogToFile(autoOpenDepth, filenamePtr); - filename.Dispose(); + filename.Recycle(); } public static bool MenuItem( @@ -399,8 +399,8 @@ public static unsafe partial class ImGui shortcutPtr, selected ? (byte)1 : (byte)0, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); - shortcut.Dispose(); + label.Recycle(); + shortcut.Recycle(); return r; } } @@ -412,8 +412,8 @@ public static unsafe partial class ImGui fixed (bool* selectedPtr = &selected) { var r = ImGuiNative.MenuItem(labelPtr, shortcutPtr, selectedPtr, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); - shortcut.Dispose(); + label.Recycle(); + shortcut.Recycle(); return r; } } @@ -424,7 +424,7 @@ public static unsafe partial class ImGui fixed (bool* selectedPtr = &selected) { var r = ImGuiNative.MenuItem(labelPtr, null, selectedPtr, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -438,7 +438,7 @@ public static unsafe partial class ImGui null, selected ? (byte)1 : (byte)0, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -447,7 +447,7 @@ public static unsafe partial class ImGui { fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) ImGuiNative.OpenPopup(strIdPtr, popupFlags); - strId.Dispose(); + strId.Recycle(); } public static void OpenPopup(uint id, ImGuiPopupFlags popupFlags = ImGuiPopupFlags.None) => @@ -458,21 +458,21 @@ public static unsafe partial class ImGui { fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) ImGuiNative.OpenPopupOnItemClick(strIdPtr, popupFlags); - strId.Dispose(); + strId.Recycle(); } public static void ProgressBar(float fraction, Vector2 sizeArg, ImU8String overlay = default) { fixed (byte* overlayPtr = &overlay.GetPinnableNullTerminatedReference()) ImGuiNative.ProgressBar(fraction, sizeArg, overlayPtr); - overlay.Dispose(); + overlay.Recycle(); } public static void ProgressBar(float fraction, ImU8String overlay = default) { fixed (byte* overlayPtr = &overlay.GetPinnableNullTerminatedReference()) ImGuiNative.ProgressBar(fraction, new(-float.MinValue, 0), overlayPtr); - overlay.Dispose(); + overlay.Recycle(); } public static bool RadioButton(ImU8String label, bool active) @@ -480,7 +480,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.RadioButton(labelPtr, active ? (byte)1 : (byte)0) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -511,7 +511,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.Selectable(labelPtr, selected ? (byte)1 : (byte)0, flags, size) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -524,7 +524,7 @@ public static unsafe partial class ImGui fixed (bool* selectedPtr = &selected) { var r = ImGuiNative.Selectable(labelPtr, selectedPtr, flags, size) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -533,7 +533,7 @@ public static unsafe partial class ImGui { fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference()) ImGuiNative.SetClipboardText(textPtr); - text.Dispose(); + text.Recycle(); } public static bool SetDragDropPayload(ImU8String type, ReadOnlySpan data, ImGuiCond cond) @@ -542,7 +542,7 @@ public static unsafe partial class ImGui fixed (byte* dataPtr = data) { var r = ImGuiNative.SetDragDropPayload(typePtr, dataPtr, (nuint)data.Length, cond) != 0; - type.Dispose(); + type.Recycle(); return r; } } @@ -551,7 +551,7 @@ public static unsafe partial class ImGui { fixed (byte* tabItemPtr = &tabOrDockedWindowLabel.GetPinnableNullTerminatedReference()) ImGuiNative.SetTabItemClosed(tabItemPtr); - tabOrDockedWindowLabel.Dispose(); + tabOrDockedWindowLabel.Recycle(); } public static void SetWindowCollapsed(bool collapsed, ImGuiCond cond = ImGuiCond.None) => @@ -561,7 +561,7 @@ public static unsafe partial class ImGui { fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) ImGuiNative.SetWindowCollapsed(namePtr, collapsed ? (byte)1 : (byte)0, cond); - name.Dispose(); + name.Recycle(); } /// Sets the current window to be focused / top-most. @@ -574,7 +574,7 @@ public static unsafe partial class ImGui { fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) ImGuiNative.SetWindowFocus(namePtr); - name.Dispose(); + name.Recycle(); } /// Removes focus from any window. @@ -587,7 +587,7 @@ public static unsafe partial class ImGui { fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) ImGuiNative.SetWindowPos(namePtr, pos, cond); - name.Dispose(); + name.Recycle(); } public static void SetWindowSize(Vector2 size, ImGuiCond cond = ImGuiCond.None) => @@ -597,14 +597,14 @@ public static unsafe partial class ImGui { fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) ImGuiNative.SetWindowSize(namePtr, size, cond); - name.Dispose(); + name.Recycle(); } public static void ShowFontSelector(ImU8String label) { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiNative.ShowFontSelector(labelPtr); - label.Dispose(); + label.Recycle(); } public static bool ShowStyleSelector(ImU8String label) @@ -612,7 +612,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.ShowStyleSelector(labelPtr) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -622,7 +622,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.SmallButton(labelPtr) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -632,7 +632,7 @@ public static unsafe partial class ImGui fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiNative.TabItemButton(labelPtr, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -641,7 +641,7 @@ public static unsafe partial class ImGui { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiNative.TableHeader(labelPtr); - label.Dispose(); + label.Recycle(); } public static void TableSetupColumn( @@ -650,14 +650,14 @@ public static unsafe partial class ImGui { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiNative.TableSetupColumn(labelPtr, flags, initWidthOrWeight, userId); - label.Dispose(); + label.Recycle(); } public static void TreePush(ImU8String strId) { fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) ImGuiNative.TreePush(strIdPtr); - strId.Dispose(); + strId.Recycle(); } public static void TreePush(nint ptrId) => ImGuiNative.TreePush((void*)ptrId); @@ -670,7 +670,7 @@ public static unsafe partial class ImGui fixed (byte* prefixPtr = prefix) { ImGuiNative.TextUnformatted(prefixPtr, prefixPtr + prefix.Length); - prefix.Dispose(); + prefix.Recycle(); } } @@ -682,8 +682,8 @@ public static unsafe partial class ImGui fixed (byte* floatPtr = &floatFormat.GetPinnableNullTerminatedReference()) { ImGuiNative.Value(prefixPtr, value, floatPtr); - prefix.Dispose(); - floatFormat.Dispose(); + prefix.Recycle(); + floatFormat.Recycle(); } } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Misc.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Misc.cs index 8e61f8f07..3947d18d2 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Misc.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Misc.cs @@ -12,7 +12,7 @@ public unsafe partial class ImGuiP fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.ArrowButtonEx(strIdPtr, dir, sizeArg, flags) != 0; - strId.Dispose(); + strId.Recycle(); return r; } } @@ -22,7 +22,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.BeginChildEx(namePtr, id, sizeArg, border ? (byte)1 : (byte)0, flags) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -31,7 +31,7 @@ public unsafe partial class ImGuiP { fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) ImGuiPNative.BeginColumns(strIdPtr, count, flags); - strId.Dispose(); + strId.Recycle(); } public static bool BeginMenuEx(ImU8String label, ImU8String icon = default, bool enabled = true) @@ -40,8 +40,8 @@ public unsafe partial class ImGuiP fixed (byte* iconPtr = &icon.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.BeginMenuEx(labelPtr, iconPtr, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); - icon.Dispose(); + label.Recycle(); + icon.Recycle(); return r; } } @@ -53,7 +53,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.BeginTableEx(namePtr, id, columnsCount, flags, outerSize, innerWidth) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -64,7 +64,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.BeginViewportSideBar(namePtr, viewport, dir, size, windowFlags) != 0; - name.Dispose(); + name.Recycle(); return r; } } @@ -75,7 +75,7 @@ public unsafe partial class ImGuiP fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.ButtonEx(labelPtr, sizeArg, flags) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -97,7 +97,7 @@ public unsafe partial class ImGuiP fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference()) fixed (float* colPtr = col) ImGuiPNative.ColorTooltip(textPtr, colPtr, flags); - text.Dispose(); + text.Recycle(); } public static ImGuiWindowSettingsPtr CreateNewWindowSettings(ImU8String name) @@ -105,7 +105,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.CreateNewWindowSettings(namePtr); - name.Dispose(); + name.Recycle(); return r; } } @@ -123,8 +123,8 @@ public unsafe partial class ImGuiP fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.DataTypeApplyFromText(bufPtr, dataType, &data, formatPtr) != 0; - format.Dispose(); - buf.Dispose(); + format.Recycle(); + buf.Recycle(); return r; } } @@ -133,7 +133,7 @@ public unsafe partial class ImGuiP { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiPNative.DebugNodeDockNode(node, labelPtr); - label.Dispose(); + label.Recycle(); } public static void DebugNodeDrawList( @@ -141,28 +141,28 @@ public unsafe partial class ImGuiP { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiPNative.DebugNodeDrawList(window, viewport, drawList, labelPtr); - label.Dispose(); + label.Recycle(); } public static void DebugNodeStorage(ImGuiStoragePtr storage, ImU8String label) { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiPNative.DebugNodeStorage(storage, labelPtr); - label.Dispose(); + label.Recycle(); } public static void DebugNodeTabBar(ImGuiTabBarPtr tabBar, ImU8String label) { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiPNative.DebugNodeTabBar(tabBar, labelPtr); - label.Dispose(); + label.Recycle(); } public static void DebugNodeWindow(ImGuiWindowPtr window, ImU8String label) { fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiPNative.DebugNodeWindow(window, labelPtr); - label.Dispose(); + label.Recycle(); } public static void DebugNodeWindowsList(scoped in ImVector windows, ImU8String label) @@ -170,7 +170,7 @@ public unsafe partial class ImGuiP fixed (ImVector* windowsPtr = &windows) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) ImGuiPNative.DebugNodeWindowsList(windowsPtr, labelPtr); - label.Dispose(); + label.Recycle(); } public static void DockBuilderCopyWindowSettings(ImU8String srcName, ImU8String dstName) @@ -178,15 +178,15 @@ public unsafe partial class ImGuiP fixed (byte* srcNamePtr = &srcName.GetPinnableNullTerminatedReference()) fixed (byte* dstNamePtr = &dstName.GetPinnableNullTerminatedReference()) ImGuiPNative.DockBuilderCopyWindowSettings(srcNamePtr, dstNamePtr); - srcName.Dispose(); - dstName.Dispose(); + srcName.Recycle(); + dstName.Recycle(); } public static void DockBuilderDockWindow(ImU8String windowName, uint nodeId) { fixed (byte* windowNamePtr = &windowName.GetPinnableNullTerminatedReference()) ImGuiPNative.DockBuilderDockWindow(windowNamePtr, nodeId); - windowName.Dispose(); + windowName.Recycle(); } public static bool DragBehavior( @@ -196,7 +196,7 @@ public unsafe partial class ImGuiP fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.DragBehavior(id, dataType, pV, vSpeed, pMin, pMax, formatPtr, flags) != 0; - format.Dispose(); + format.Recycle(); return r; } } @@ -206,7 +206,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.FindOrCreateWindowSettings(namePtr); - name.Dispose(); + name.Recycle(); return r; } } @@ -216,7 +216,7 @@ public unsafe partial class ImGuiP fixed (byte* typeNamePtr = &typeName.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.FindSettingsHandler(typeNamePtr); - typeName.Dispose(); + typeName.Recycle(); return r; } } @@ -226,7 +226,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.FindWindowByName(namePtr); - name.Dispose(); + name.Recycle(); return r; } } @@ -236,7 +236,7 @@ public unsafe partial class ImGuiP fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.GetColumnsID(strIdPtr, count); - strId.Dispose(); + strId.Recycle(); return r; } } @@ -246,7 +246,7 @@ public unsafe partial class ImGuiP fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.GetIDWithSeed(strIdPtr, strIdPtr + strId.Length, seed); - strId.Dispose(); + strId.Recycle(); return r; } } @@ -259,8 +259,8 @@ public unsafe partial class ImGuiP fixed (nuint* outFileSizePtr = &outFileSize) { var r = ImGuiPNative.ImFileLoadToMemory(filenamePtr, modePtr, outFileSizePtr, paddingBytes); - filename.Dispose(); - mode.Dispose(); + filename.Recycle(); + mode.Recycle(); return r; } } @@ -271,8 +271,8 @@ public unsafe partial class ImGuiP fixed (byte* modePtr = &mode.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.ImFileLoadToMemory(filenamePtr, modePtr, null, paddingBytes); - filename.Dispose(); - mode.Dispose(); + filename.Recycle(); + mode.Recycle(); return r; } } @@ -283,8 +283,8 @@ public unsafe partial class ImGuiP fixed (byte* modePtr = &mode.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.ImFileOpen(filenamePtr, modePtr); - filename.Dispose(); - mode.Dispose(); + filename.Recycle(); + mode.Recycle(); return r; } } @@ -339,7 +339,7 @@ public unsafe partial class ImGuiP { fixed (byte* fmtPtr = &fmt.GetPinnableNullTerminatedReference()) ImGuiPNative.ImFormatStringToTempBuffer(outBuf, outBufEnd, fmtPtr); - fmt.Dispose(); + fmt.Recycle(); } public static ImGuiWindowPtr ImGuiWindow(ImGuiContextPtr context, ImU8String name) @@ -347,7 +347,7 @@ public unsafe partial class ImGuiP fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.ImGuiWindow(context, namePtr); - name.Dispose(); + name.Recycle(); return r; } } @@ -386,9 +386,9 @@ public unsafe partial class ImGuiP shortcutPtr, selected ? (byte)1 : (byte)0, enabled ? (byte)1 : (byte)0) != 0; - label.Dispose(); - icon.Dispose(); - shortcut.Dispose(); + label.Recycle(); + icon.Recycle(); + shortcut.Recycle(); return r; } } @@ -397,7 +397,7 @@ public unsafe partial class ImGuiP { fixed (byte* typeNamePtr = &typeName.GetPinnableNullTerminatedReference()) ImGuiPNative.RemoveSettingsHandler(typeNamePtr); - typeName.Dispose(); + typeName.Recycle(); } public static bool SliderBehavior( @@ -418,7 +418,7 @@ public unsafe partial class ImGuiP formatPtr, flags, outGrabBb) != 0; - format.Dispose(); + format.Recycle(); return r; } } @@ -440,7 +440,7 @@ public unsafe partial class ImGuiP fixed (bool* openPtr = &open) { var r = ImGuiPNative.TabItemEx(tabBar, labelPtr, openPtr, flags, dockedWindow) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -466,7 +466,7 @@ public unsafe partial class ImGuiP textClippedPtr); } - label.Dispose(); + label.Recycle(); } public static bool TempInputScalar( @@ -479,7 +479,7 @@ public unsafe partial class ImGuiP fixed (T* dataPtr = &data) { var r = ImGuiPNative.TempInputScalar(bb, id, labelPtr, dataType, dataPtr, formatPtr, &min, &max) != 0; - label.Dispose(); + label.Recycle(); return r; } } @@ -489,7 +489,7 @@ public unsafe partial class ImGuiP fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) { var r = ImGuiPNative.TreeNodeBehavior(id, flags, labelPtr, labelPtr + label.Length) != 0; - label.Dispose(); + label.Recycle(); return r; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Plot.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Plot.cs index 8f3f56fc5..aab161b9c 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Plot.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Plot.cs @@ -27,8 +27,8 @@ public static unsafe partial class ImGuiP scaleMin, scaleMax, frameSize); - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); return r; } } @@ -59,8 +59,8 @@ public static unsafe partial class ImGuiP scaleMin, scaleMax, frameSize); - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); return r; } } @@ -91,8 +91,8 @@ public static unsafe partial class ImGuiP scaleMin, scaleMax, frameSize); - label.Dispose(); - overlayText.Dispose(); + label.Recycle(); + overlayText.Recycle(); return r; } } diff --git a/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Text.cs b/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Text.cs index 1bff86b1a..c4a2a48a9 100644 --- a/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Text.cs +++ b/imgui/Dalamud.Bindings.ImGui/Custom/ImGuiP.Text.cs @@ -13,7 +13,7 @@ public static unsafe partial class ImGuiP ImGui.append(&g->DebugLogBuf, text.Span); if ((g->DebugLogFlags & ImGuiDebugLogFlags.OutputToTty) != ImGuiDebugLogFlags.None) Debug.Write(text.ToString()); - text.Dispose(); + text.Recycle(); } public static int FindRenderedTextEnd( @@ -35,7 +35,7 @@ public static unsafe partial class ImGuiP FindRenderedTextEnd(textBuf.Span, out var beforeBytes, out var afterBytes); before = text[..Encoding.UTF8.GetCharCount(beforeBytes)]; after = text[before.Length..]; - textBuf.Dispose(); + textBuf.Recycle(); return before.Length; } @@ -48,7 +48,7 @@ public static unsafe partial class ImGuiP var g = ImGui.GetCurrentContext(); if (g.DebugHookIdInfo == id) DebugHookIdInfo(id, (ImGuiDataType)ImGuiDataTypePrivate.String, strPtr, strPtr + str.Length); - str.Dispose(); + str.Recycle(); return id; } } @@ -66,7 +66,7 @@ public static unsafe partial class ImGuiP fixed (byte* ptr = data) { var res = ImGuiPNative.ImHashStr(ptr, (nuint)data.Length, seed); - data.Dispose(); + data.Recycle(); return res; } } @@ -135,14 +135,14 @@ public static unsafe partial class ImGuiP fixed (Vector2* refPosPtr = &refPos) fixed (byte* textPtr = text) ImGuiPNative.LogRenderedText(refPosPtr, textPtr, textPtr + text.Length); - text.Dispose(); + text.Recycle(); } public static void RenderText(Vector2 pos, ImU8String text, bool hideTextAfterHash = true) { fixed (byte* textPtr = text) ImGuiPNative.RenderText(pos, textPtr, textPtr + text.Length, hideTextAfterHash ? (byte)1 : (byte)0); - text.Dispose(); + text.Recycle(); } public static void RenderTextWrapped( @@ -150,7 +150,7 @@ public static unsafe partial class ImGuiP { fixed (byte* textPtr = text) ImGuiPNative.RenderTextWrapped(pos, textPtr, textPtr + text.Length, wrapWidth); - text.Dispose(); + text.Recycle(); } public static void RenderTextClipped( @@ -169,7 +169,7 @@ public static unsafe partial class ImGuiP textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null, align, clipRect.HasValue ? &clipRectOrDefault : null); - text.Dispose(); + text.Recycle(); } public static void RenderTextClippedEx( @@ -189,7 +189,7 @@ public static unsafe partial class ImGuiP textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null, align, clipRect.HasValue ? &clipRectOrDefault : null); - text.Dispose(); + text.Recycle(); } public static void RenderTextEllipsis( @@ -207,7 +207,7 @@ public static unsafe partial class ImGuiP textPtr, textPtr + text.Length, textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null); - text.Dispose(); + text.Recycle(); } public static void TextEx(ReadOnlySpan text, ImGuiTextFlags flags) diff --git a/imgui/Dalamud.Bindings.ImGui/ImU8String.cs b/imgui/Dalamud.Bindings.ImGui/ImU8String.cs index 88858ca10..17756ae61 100644 --- a/imgui/Dalamud.Bindings.ImGui/ImU8String.cs +++ b/imgui/Dalamud.Bindings.ImGui/ImU8String.cs @@ -8,7 +8,7 @@ using System.Text.Unicode; namespace Dalamud.Bindings.ImGui; [InterpolatedStringHandler] -public ref struct ImU8String : IDisposable +public ref struct ImU8String { public const int AllocFreeBufferSize = 512; private const int MinimumRentSize = AllocFreeBufferSize * 2; @@ -247,7 +247,7 @@ public ref struct ImU8String : IDisposable this.externalFirstByte = ref Unsafe.NullRef(); } - public void Dispose() + public void Recycle() { if (this.rentedBuffer is { } buf) { @@ -260,7 +260,7 @@ public ref struct ImU8String : IDisposable { if (!this.IsNull) { - other.Dispose(); + other.Recycle(); var res = this; this = default; return res;