Make ImU8String not IDisposable

This commit is contained in:
Soreepeong 2025-08-08 21:27:40 +09:00
parent 5fee90085c
commit afe58dae76
15 changed files with 267 additions and 267 deletions

View file

@ -203,8 +203,8 @@ public static partial class ImGuiHelpers
ImGui.SetClipboardText(textCopy.IsNull ? text.Span : textCopy.Span); ImGui.SetClipboardText(textCopy.IsNull ? text.Span : textCopy.Span);
} }
text.Dispose(); text.Recycle();
textCopy.Dispose(); textCopy.Recycle();
} }
/// <summary>Draws a SeString.</summary> /// <summary>Draws a SeString.</summary>

View file

@ -13,7 +13,7 @@ public static unsafe partial class ImGui
fixed (Vector3* colPtr = &col) fixed (Vector3* colPtr = &col)
{ {
var res = ImGuiNative.ColorEdit3(labelPtr, &colPtr->X, flags) != 0; var res = ImGuiNative.ColorEdit3(labelPtr, &colPtr->X, flags) != 0;
label.Dispose(); label.Recycle();
return res; return res;
} }
} }
@ -25,7 +25,7 @@ public static unsafe partial class ImGui
fixed (Vector4* colPtr = &col) fixed (Vector4* colPtr = &col)
{ {
var res = ImGuiNative.ColorEdit4(labelPtr, &colPtr->X, flags) != 0; var res = ImGuiNative.ColorEdit4(labelPtr, &colPtr->X, flags) != 0;
label.Dispose(); label.Recycle();
return res; return res;
} }
} }
@ -37,7 +37,7 @@ public static unsafe partial class ImGui
fixed (Vector3* colPtr = &col) fixed (Vector3* colPtr = &col)
{ {
var res = ImGuiNative.ColorPicker3(labelPtr, &colPtr->X, flags) != 0; var res = ImGuiNative.ColorPicker3(labelPtr, &colPtr->X, flags) != 0;
label.Dispose(); label.Recycle();
return res; return res;
} }
} }
@ -49,7 +49,7 @@ public static unsafe partial class ImGui
fixed (Vector4* colPtr = &col) fixed (Vector4* colPtr = &col)
{ {
var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, flags, null) != 0; var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, flags, null) != 0;
label.Dispose(); label.Recycle();
return res; return res;
} }
} }
@ -62,7 +62,7 @@ public static unsafe partial class ImGui
fixed (Vector4* refColPtr = &refCol) fixed (Vector4* refColPtr = &refCol)
{ {
var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, flags, &refColPtr->X) != 0; var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, flags, &refColPtr->X) != 0;
label.Dispose(); label.Recycle();
return res; return res;
} }
} }
@ -74,7 +74,7 @@ public static unsafe partial class ImGui
fixed (Vector4* refColPtr = &refCol) fixed (Vector4* refColPtr = &refCol)
{ {
var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, ImGuiColorEditFlags.None, &refColPtr->X) != 0; var res = ImGuiNative.ColorPicker4(labelPtr, &colPtr->X, ImGuiColorEditFlags.None, &refColPtr->X) != 0;
label.Dispose(); label.Recycle();
return res; return res;
} }
} }

View file

@ -27,8 +27,8 @@ public static unsafe partial class ImGui
fixed (byte* itemsSeparatedByZerosPtr = itemsSeparatedByZeros) fixed (byte* itemsSeparatedByZerosPtr = itemsSeparatedByZeros)
{ {
var r = ImGuiNative.Combo(labelPtr, currentItemPtr, itemsSeparatedByZerosPtr, popupMaxHeightInItems) != 0; var r = ImGuiNative.Combo(labelPtr, currentItemPtr, itemsSeparatedByZerosPtr, popupMaxHeightInItems) != 0;
label.Dispose(); label.Recycle();
itemsSeparatedByZeros.Dispose(); itemsSeparatedByZeros.Recycle();
return r; return r;
} }
} }
@ -129,8 +129,8 @@ public static unsafe partial class ImGui
&dataBuffer, &dataBuffer,
itemsCount, itemsCount,
popupMaxHeightInItems) != 0; popupMaxHeightInItems) != 0;
label.Dispose(); label.Recycle();
textBuffer.Dispose(); textBuffer.Recycle();
return r; return r;
} }
} }
@ -156,8 +156,8 @@ public static unsafe partial class ImGui
&dataBuffer, &dataBuffer,
itemsCount, itemsCount,
popupMaxHeightInItems) != 0; popupMaxHeightInItems) != 0;
label.Dispose(); label.Recycle();
textBuffer.Dispose(); textBuffer.Recycle();
return r; return r;
} }
} }
@ -181,8 +181,8 @@ public static unsafe partial class ImGui
&dataBuffer, &dataBuffer,
itemsCount, itemsCount,
popupMaxHeightInItems) != 0; popupMaxHeightInItems) != 0;
label.Dispose(); label.Recycle();
textBuffer.Dispose(); textBuffer.Recycle();
return r; return r;
} }
} }
@ -282,8 +282,8 @@ public static unsafe partial class ImGui
&dataBuffer, &dataBuffer,
itemsCount, itemsCount,
heightInItems) != 0; heightInItems) != 0;
label.Dispose(); label.Recycle();
textBuffer.Dispose(); textBuffer.Recycle();
return r; return r;
} }
} }
@ -309,8 +309,8 @@ public static unsafe partial class ImGui
&dataBuffer, &dataBuffer,
itemsCount, itemsCount,
heightInItems) != 0; heightInItems) != 0;
label.Dispose(); label.Recycle();
textBuffer.Dispose(); textBuffer.Recycle();
return r; return r;
} }
} }
@ -334,8 +334,8 @@ public static unsafe partial class ImGui
&dataBuffer, &dataBuffer,
itemsCount, itemsCount,
heightInItems) != 0; heightInItems) != 0;
label.Dispose(); label.Recycle();
textBuffer.Dispose(); textBuffer.Recycle();
return r; 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 #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<PopulateAutoUtf8BufferRefContextDelegate<object>, ImU8String, object>(data); ref var s = ref PointerTuple.From<PopulateAutoUtf8BufferRefContextDelegate<object>, ImU8String, object>(data);
s.Item2.Dispose(); s.Item2.Recycle();
s.Item2 = s.Item1.Invoke(ref s.Item3, index); s.Item2 = s.Item1.Invoke(ref s.Item3, index);
if (s.Item2.IsNull) if (s.Item2.IsNull)
return false; 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 #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<PopulateAutoUtf8BufferInContextDelegate<object>, ImU8String, object>(data); ref var s = ref PointerTuple.From<PopulateAutoUtf8BufferInContextDelegate<object>, ImU8String, object>(data);
s.Item2.Dispose(); s.Item2.Recycle();
s.Item2 = s.Item1.Invoke(s.Item3, index); s.Item2 = s.Item1.Invoke(s.Item3, index);
if (s.Item2.IsNull) if (s.Item2.IsNull)
return false; 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 #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<PopulateAutoUtf8BufferDelegate, ImU8String>(data); ref var s = ref PointerTuple.From<PopulateAutoUtf8BufferDelegate, ImU8String>(data);
s.Item2.Dispose(); s.Item2.Recycle();
s.Item2 = s.Item1.Invoke(index); s.Item2 = s.Item1.Invoke(index);
if (s.Item2.IsNull) if (s.Item2.IsNull)
return false; return false;

View file

@ -309,8 +309,8 @@ public static unsafe partial class ImGui
fixed (T* vMaxPtr = &vMax) fixed (T* vMaxPtr = &vMax)
{ {
var res = ImGuiNative.DragScalar(labelPtr, dataType, vPtr, vSpeed, vMinPtr, vMaxPtr, formatPtr, flags) != 0; var res = ImGuiNative.DragScalar(labelPtr, dataType, vPtr, vSpeed, vMinPtr, vMaxPtr, formatPtr, flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -336,8 +336,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -362,8 +362,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -389,8 +389,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -418,9 +418,9 @@ public static unsafe partial class ImGui
formatPtr, formatPtr,
formatMaxPtr, formatMaxPtr,
flags); flags);
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
formatMax.Dispose(); formatMax.Recycle();
return res != 0; return res != 0;
} }
} }
@ -448,9 +448,9 @@ public static unsafe partial class ImGui
formatPtr, formatPtr,
formatMaxPtr, formatMaxPtr,
flags); flags);
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
formatMax.Dispose(); formatMax.Recycle();
return res != 0; return res != 0;
} }
} }

View file

@ -274,8 +274,8 @@ public static unsafe partial class ImGui
stepFast > T.Zero ? stepFastPtr : null, stepFast > T.Zero ? stepFastPtr : null,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -302,8 +302,8 @@ public static unsafe partial class ImGui
stepFast > T.Zero ? stepFastPtr : null, stepFast > T.Zero ? stepFastPtr : null,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -329,8 +329,8 @@ public static unsafe partial class ImGui
stepFast > T.Zero ? stepFastPtr : null, stepFast > T.Zero ? stepFastPtr : null,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -357,8 +357,8 @@ public static unsafe partial class ImGui
stepFast > T.Zero ? stepFastPtr : null, stepFast > T.Zero ? stepFastPtr : null,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }

View file

@ -26,7 +26,7 @@ public unsafe partial class ImGui
fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference())
{ {
var len = ImGuiNative.DataTypeFormatString(bufPtr, buf.Length, dataType, &data, formatPtr); var len = ImGuiNative.DataTypeFormatString(bufPtr, buf.Length, dataType, &data, formatPtr);
format.Dispose(); format.Recycle();
return buf[..len]; return buf[..len];
} }
} }
@ -39,7 +39,7 @@ public unsafe partial class ImGui
fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference())
fixed (byte* bufPtr = buf) fixed (byte* bufPtr = buf)
ImGuiNative.ImParseFormatTrimDecorations(formatPtr, bufPtr, (nuint)buf.Length); ImGuiNative.ImParseFormatTrimDecorations(formatPtr, bufPtr, (nuint)buf.Length);
format.Dispose(); format.Recycle();
var nul = buf.IndexOf((byte)0); var nul = buf.IndexOf((byte)0);
return nul == -1 ? buf : buf[..nul]; 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 r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -142,7 +142,7 @@ public unsafe partial class ImGui
var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback); var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -155,7 +155,7 @@ public unsafe partial class ImGui
var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback, ref context); var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback, ref context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -168,7 +168,7 @@ public unsafe partial class ImGui
var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback, in context); var r = InputText(label, t.Buffer[..(maxLength + 1)], flags, callback, in context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -192,8 +192,8 @@ public unsafe partial class ImGui
flags, flags,
callback == null ? null : &InputTextCallbackStatic, callback == null ? null : &InputTextCallbackStatic,
callback == null ? null : &dataBuffer) != 0; callback == null ? null : &dataBuffer) != 0;
label.Dispose(); label.Recycle();
hint.Dispose(); hint.Recycle();
return r; return r;
} }
} }
@ -218,8 +218,8 @@ public unsafe partial class ImGui
flags, flags,
callback == null ? null : &InputTextCallbackPtrStatic, callback == null ? null : &InputTextCallbackPtrStatic,
callback == null ? null : &dataBuffer) != 0; callback == null ? null : &dataBuffer) != 0;
label.Dispose(); label.Recycle();
hint.Dispose(); hint.Recycle();
return r; return r;
} }
} }
@ -245,8 +245,8 @@ public unsafe partial class ImGui
flags, flags,
&InputTextCallbackRefContextStatic, &InputTextCallbackRefContextStatic,
&dataBuffer) != 0; &dataBuffer) != 0;
label.Dispose(); label.Recycle();
hint.Dispose(); hint.Recycle();
return r; return r;
} }
} }
@ -272,8 +272,8 @@ public unsafe partial class ImGui
flags, flags,
&InputTextCallbackInContextStatic, &InputTextCallbackInContextStatic,
&dataBuffer) != 0; &dataBuffer) != 0;
label.Dispose(); label.Recycle();
hint.Dispose(); hint.Recycle();
return r; return r;
} }
} }
@ -289,7 +289,7 @@ public unsafe partial class ImGui
var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback); var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -302,7 +302,7 @@ public unsafe partial class ImGui
var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback); var r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; 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 r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback, ref context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; 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 r = InputTextEx(label, hint, t.Buffer[..(maxLength + 1)], sizeArg, flags, callback, in context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -390,7 +390,7 @@ public unsafe partial class ImGui
var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback); var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -403,7 +403,7 @@ public unsafe partial class ImGui
var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback); var r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; 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 r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback, ref context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; 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 r = InputTextMultiline(label, t.Buffer[..(maxLength + 1)], size, flags, callback, in context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -479,7 +479,7 @@ public unsafe partial class ImGui
var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback); var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -492,7 +492,7 @@ public unsafe partial class ImGui
var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback); var r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; 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 r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback, ref context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; 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 r = InputTextWithHint(label, hint, t.Buffer[..(maxLength + 1)], flags, callback, in context);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }
@ -529,7 +529,7 @@ public unsafe partial class ImGui
fixed (byte* bufPtr = buf) fixed (byte* bufPtr = buf)
{ {
var r = ImGuiNative.TempInputText(bb, id, labelPtr, bufPtr, buf.Length, flags) != 0; var r = ImGuiNative.TempInputText(bb, id, labelPtr, bufPtr, buf.Length, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -543,7 +543,7 @@ public unsafe partial class ImGui
var r = TempInputText(bb, id, label, t.Buffer[..(maxLength + 1)], flags); var r = TempInputText(bb, id, label, t.Buffer[..(maxLength + 1)], flags);
var i = t.Buffer.IndexOf((byte)0); var i = t.Buffer.IndexOf((byte)0);
buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]); buf = Encoding.UTF8.GetString(i == -1 ? t.Buffer : t.Buffer[..i]);
t.Dispose(); t.Recycle();
return r; return r;
} }

View file

@ -27,7 +27,7 @@ public static unsafe partial class ImGui
fixed (byte* typePtr = &type.GetPinnableNullTerminatedReference()) fixed (byte* typePtr = &type.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.AcceptDragDropPayload(typePtr, flags); var r = ImGuiNative.AcceptDragDropPayload(typePtr, flags);
type.Dispose(); type.Recycle();
return r; return r;
} }
} }
@ -39,7 +39,7 @@ public static unsafe partial class ImGui
fixed (byte* filenamePtr = &filename.GetPinnableNullTerminatedReference()) fixed (byte* filenamePtr = &filename.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.AddFontFromFileTTF(self, filenamePtr, sizePixels, fontCfg, glyphRanges); var r = ImGuiNative.AddFontFromFileTTF(self, filenamePtr, sizePixels, fontCfg, glyphRanges);
filename.Dispose(); filename.Recycle();
return r; return r;
} }
} }
@ -56,7 +56,7 @@ public static unsafe partial class ImGui
sizePixels, sizePixels,
fontCfg, fontCfg,
glyphRanges); glyphRanges);
compressedFontDatabase85.Dispose(); compressedFontDatabase85.Recycle();
return r; return r;
} }
} }
@ -96,7 +96,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* strPtr = &str.GetPinnableNullTerminatedReference()) fixed (byte* strPtr = &str.GetPinnableNullTerminatedReference())
ImGuiNative.AddInputCharactersUTF8(self.Handle, strPtr); ImGuiNative.AddInputCharactersUTF8(self.Handle, strPtr);
str.Dispose(); str.Recycle();
} }
public static ref bool GetBoolRef(ImGuiStoragePtr self, uint key, bool defaultValue = false) => 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) fixed (byte* strIdPtr = strId)
{ {
var r = ImGuiNative.GetID(strIdPtr, strIdPtr + strId.Length); var r = ImGuiNative.GetID(strIdPtr, strIdPtr + strId.Length);
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -139,7 +139,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = strId) fixed (byte* strIdPtr = strId)
{ {
ImGuiNative.PushID(strIdPtr, strIdPtr + strId.Length); ImGuiNative.PushID(strIdPtr, strIdPtr + strId.Length);
strId.Dispose(); strId.Recycle();
} }
} }

View file

@ -34,8 +34,8 @@ public static unsafe partial class ImGui
stride); stride);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotHistogram<TContext>( public static void PlotHistogram<TContext>(
@ -66,8 +66,8 @@ public static unsafe partial class ImGui
graphSize); graphSize);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotHistogram<TContext>( public static void PlotHistogram<TContext>(
@ -97,8 +97,8 @@ public static unsafe partial class ImGui
graphSize); graphSize);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotHistogram( public static void PlotHistogram(
@ -126,8 +126,8 @@ public static unsafe partial class ImGui
graphSize); graphSize);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotLines( public static void PlotLines(
@ -151,8 +151,8 @@ public static unsafe partial class ImGui
stride); stride);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotLines<TContext>( public static void PlotLines<TContext>(
@ -182,8 +182,8 @@ public static unsafe partial class ImGui
graphSize); graphSize);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotLines<TContext>( public static void PlotLines<TContext>(
@ -214,8 +214,8 @@ public static unsafe partial class ImGui
graphSize); graphSize);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
public static void PlotLines( public static void PlotLines(
@ -243,8 +243,8 @@ public static unsafe partial class ImGui
graphSize); graphSize);
} }
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
} }
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type #pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type

View file

@ -277,8 +277,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -305,8 +305,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -332,8 +332,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -360,8 +360,8 @@ public static unsafe partial class ImGui
vMaxPtr, vMaxPtr,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -383,8 +383,8 @@ public static unsafe partial class ImGui
vDegreesMax, vDegreesMax,
formatPtr, formatPtr,
flags) != 0; flags) != 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }
@ -466,8 +466,8 @@ public static unsafe partial class ImGui
{ {
var res = ImGuiNative.VSliderScalar(labelPtr, size, dataType, dataPtr, minPtr, maxPtr, formatPtr, flags) != var res = ImGuiNative.VSliderScalar(labelPtr, size, dataType, dataPtr, minPtr, maxPtr, formatPtr, flags) !=
0; 0;
label.Dispose(); label.Recycle();
format.Dispose(); format.Recycle();
return res; return res;
} }
} }

View file

@ -10,14 +10,14 @@ public static unsafe partial class ImGui
{ {
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
ImGuiNative.AddText(self.Handle, textPtr, textPtr + text.Length); ImGuiNative.AddText(self.Handle, textPtr, textPtr + text.Length);
text.Dispose(); text.Recycle();
} }
public static void AddText(ImDrawListPtr self, Vector2 pos, uint col, ImU8String text) public static void AddText(ImDrawListPtr self, Vector2 pos, uint col, ImU8String text)
{ {
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
ImGuiNative.AddText(self.Handle, pos, col, textPtr, textPtr + text.Length); ImGuiNative.AddText(self.Handle, pos, col, textPtr, textPtr + text.Length);
text.Dispose(); text.Recycle();
} }
public static void AddText( public static void AddText(
@ -36,7 +36,7 @@ public static unsafe partial class ImGui
textPtr + text.Length, textPtr + text.Length,
wrapWidth, wrapWidth,
cpuFineClipRectPtr); cpuFineClipRectPtr);
text.Dispose(); text.Recycle();
} }
public static void AddText( public static void AddText(
@ -45,14 +45,14 @@ public static unsafe partial class ImGui
{ {
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
ImGuiNative.AddText(self.Handle, font, fontSize, pos, col, textPtr, textPtr + text.Length, wrapWidth, null); 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) public static void append(this ImGuiTextBufferPtr self, ImU8String str)
{ {
fixed (byte* strPtr = str) fixed (byte* strPtr = str)
ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length); ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length);
str.Dispose(); str.Recycle();
} }
public static void BulletText(ImU8String text) public static void BulletText(ImU8String text)
@ -92,7 +92,7 @@ public static unsafe partial class ImGui
textPtr + text.Length, textPtr + text.Length,
hideTextAfterDoubleHash ? (byte)1 : (byte)0, hideTextAfterDoubleHash ? (byte)1 : (byte)0,
wrapWidth); wrapWidth);
text.Dispose(); text.Recycle();
return @out; return @out;
} }
@ -115,7 +115,7 @@ public static unsafe partial class ImGui
remaining = (int)(remainingPtr - textPtr); remaining = (int)(remainingPtr - textPtr);
} }
text.Dispose(); text.Recycle();
return @out; return @out;
} }
@ -126,7 +126,7 @@ public static unsafe partial class ImGui
{ {
var r = var r =
(int)(ImGuiNative.CalcWordWrapPositionA(font.Handle, scale, ptr, ptr + text.Length, wrapWidth) - ptr); (int)(ImGuiNative.CalcWordWrapPositionA(font.Handle, scale, ptr, ptr + text.Length, wrapWidth) - ptr);
text.Dispose(); text.Recycle();
return r; return r;
} }
} }
@ -136,7 +136,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* ptr = text) fixed (byte* ptr = text)
ImGuiNative.InsertChars(self.Handle, pos, ptr, ptr + text.Length); ImGuiNative.InsertChars(self.Handle, pos, ptr, ptr + text.Length);
text.Dispose(); text.Recycle();
} }
public static void LabelText( public static void LabelText(
@ -146,8 +146,8 @@ public static unsafe partial class ImGui
var window = ImGuiP.GetCurrentWindow().Handle; var window = ImGuiP.GetCurrentWindow().Handle;
if (window->SkipItems != 0) if (window->SkipItems != 0)
{ {
label.Dispose(); label.Recycle();
text.Dispose(); text.Recycle();
return; return;
} }
@ -168,8 +168,8 @@ public static unsafe partial class ImGui
ImGuiP.ItemSize(totalBb, style.FramePadding.Y); ImGuiP.ItemSize(totalBb, style.FramePadding.Y);
if (!ImGuiP.ItemAdd(totalBb, 0)) if (!ImGuiP.ItemAdd(totalBb, 0))
{ {
label.Dispose(); label.Recycle();
text.Dispose(); text.Recycle();
return; return;
} }
@ -182,8 +182,8 @@ public static unsafe partial class ImGui
label.Span); label.Span);
} }
label.Dispose(); label.Recycle();
text.Dispose(); text.Recycle();
} }
public static void LogText(ImU8String text) public static void LogText(ImU8String text)
@ -201,7 +201,7 @@ public static unsafe partial class ImGui
append(&g.Handle->LogBuffer, text); append(&g.Handle->LogBuffer, text);
} }
text.Dispose(); text.Recycle();
} }
public static bool PassFilter(ImGuiTextFilterPtr self, ImU8String text) public static bool PassFilter(ImGuiTextFilterPtr self, ImU8String text)
@ -209,7 +209,7 @@ public static unsafe partial class ImGui
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
{ {
var r = ImGuiNative.PassFilter(self.Handle, textPtr, textPtr + text.Length) != 0; var r = ImGuiNative.PassFilter(self.Handle, textPtr, textPtr + text.Length) != 0;
text.Dispose(); text.Recycle();
return r; return r;
} }
} }
@ -230,7 +230,7 @@ public static unsafe partial class ImGui
textPtr + text.Length, textPtr + text.Length,
wrapWidth, wrapWidth,
cpuFineClip ? (byte)1 : (byte)0); cpuFineClip ? (byte)1 : (byte)0);
text.Dispose(); text.Recycle();
} }
public static void SetTooltip(ImU8String text) public static void SetTooltip(ImU8String text)
@ -238,14 +238,14 @@ public static unsafe partial class ImGui
ImGuiP.BeginTooltipEx(ImGuiTooltipFlags.OverridePreviousTooltip, ImGuiWindowFlags.None); ImGuiP.BeginTooltipEx(ImGuiTooltipFlags.OverridePreviousTooltip, ImGuiWindowFlags.None);
Text(text.Span); Text(text.Span);
EndTooltip(); EndTooltip();
text.Dispose(); text.Recycle();
} }
public static void Text(ImU8String text) public static void Text(ImU8String text)
{ {
fixed (byte* ptr = text) fixed (byte* ptr = text)
ImGuiNative.TextUnformatted(ptr, ptr + text.Length); ImGuiNative.TextUnformatted(ptr, ptr + text.Length);
text.Dispose(); text.Recycle();
} }
public static void TextColored(uint col, ImU8String text) public static void TextColored(uint col, ImU8String text)
@ -253,7 +253,7 @@ public static unsafe partial class ImGui
PushStyleColor(ImGuiCol.Text, col); PushStyleColor(ImGuiCol.Text, col);
Text(text.Span); Text(text.Span);
PopStyleColor(); PopStyleColor();
text.Dispose(); text.Recycle();
} }
public static void TextColored(scoped in Vector4 col, ImU8String text) public static void TextColored(scoped in Vector4 col, ImU8String text)
@ -261,19 +261,19 @@ public static unsafe partial class ImGui
PushStyleColor(ImGuiCol.Text, col); PushStyleColor(ImGuiCol.Text, col);
Text(text.Span); Text(text.Span);
PopStyleColor(); PopStyleColor();
text.Dispose(); text.Recycle();
} }
public static void TextDisabled(ImU8String text) public static void TextDisabled(ImU8String text)
{ {
TextColored(*GetStyleColorVec4(ImGuiCol.TextDisabled), text.Span); TextColored(*GetStyleColorVec4(ImGuiCol.TextDisabled), text.Span);
text.Dispose(); text.Recycle();
} }
public static void TextUnformatted(ImU8String text) public static void TextUnformatted(ImU8String text)
{ {
Text(text.Span); Text(text.Span);
text.Dispose(); text.Recycle();
} }
public static void TextWrapped(ImU8String text) public static void TextWrapped(ImU8String text)
@ -285,7 +285,7 @@ public static unsafe partial class ImGui
Text(text.Span); Text(text.Span);
if (needBackup) if (needBackup)
PopTextWrapPos(); PopTextWrapPos();
text.Dispose(); text.Recycle();
} }
public static void TextColoredWrapped(uint col, ImU8String text) public static void TextColoredWrapped(uint col, ImU8String text)
@ -293,7 +293,7 @@ public static unsafe partial class ImGui
PushStyleColor(ImGuiCol.Text, col); PushStyleColor(ImGuiCol.Text, col);
TextWrapped(text.Span); TextWrapped(text.Span);
PopStyleColor(); PopStyleColor();
text.Dispose(); text.Recycle();
} }
public static void TextColoredWrapped(scoped in Vector4 col, ImU8String text) public static void TextColoredWrapped(scoped in Vector4 col, ImU8String text)
@ -301,7 +301,7 @@ public static unsafe partial class ImGui
PushStyleColor(ImGuiCol.Text, col); PushStyleColor(ImGuiCol.Text, col);
TextWrapped(text.Span); TextWrapped(text.Span);
PopStyleColor(); PopStyleColor();
text.Dispose(); text.Recycle();
} }
public static bool TreeNode(ImU8String label) public static bool TreeNode(ImU8String label)
@ -309,7 +309,7 @@ public static unsafe partial class ImGui
var window = ImGuiP.GetCurrentWindow(); var window = ImGuiP.GetCurrentWindow();
if (window.SkipItems) if (window.SkipItems)
{ {
label.Dispose(); label.Recycle();
return false; return false;
} }
@ -317,7 +317,7 @@ public static unsafe partial class ImGui
window.Handle->GetID(label.Span), window.Handle->GetID(label.Span),
ImGuiTreeNodeFlags.None, ImGuiTreeNodeFlags.None,
label.Span[..ImGuiP.FindRenderedTextEnd(label.Span, out _, out _)]); label.Span[..ImGuiP.FindRenderedTextEnd(label.Span, out _, out _)]);
label.Dispose(); label.Recycle();
return res; 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]); res = ImGuiP.TreeNodeBehavior(window.Handle->GetID(id.Span), flags, label.Span[..label.Length]);
} }
id.Dispose(); id.Recycle();
label.Dispose(); label.Recycle();
return res; return res;
} }
} }

View file

@ -12,7 +12,7 @@ public static unsafe partial class ImGui
fixed (bool* openPtr = &open) fixed (bool* openPtr = &open)
{ {
var r = ImGuiNative.Begin(namePtr, openPtr, flags) != 0; var r = ImGuiNative.Begin(namePtr, openPtr, flags) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -22,7 +22,7 @@ public static unsafe partial class ImGui
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.Begin(namePtr, null, flags) != 0; var r = ImGuiNative.Begin(namePtr, null, flags) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -33,7 +33,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginChild(strIdPtr, size, border ? (byte)1 : (byte)0, flags) != 0; var r = ImGuiNative.BeginChild(strIdPtr, size, border ? (byte)1 : (byte)0, flags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -49,8 +49,8 @@ public static unsafe partial class ImGui
fixed (byte* previewValuePtr = &previewValue.GetPinnableNullTerminatedReference()) fixed (byte* previewValuePtr = &previewValue.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginCombo(labelPtr, previewValuePtr, flags) != 0; var r = ImGuiNative.BeginCombo(labelPtr, previewValuePtr, flags) != 0;
label.Dispose(); label.Recycle();
previewValue.Dispose(); previewValue.Recycle();
return r; return r;
} }
} }
@ -60,7 +60,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginListBox(labelPtr, size) != 0; var r = ImGuiNative.BeginListBox(labelPtr, size) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -70,7 +70,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginMenu(labelPtr, enabled ? (byte)1 : (byte)0) != 0; var r = ImGuiNative.BeginMenu(labelPtr, enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -80,7 +80,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginPopup(strIdPtr, flags) != 0; var r = ImGuiNative.BeginPopup(strIdPtr, flags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -91,7 +91,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginPopupContextItem(strIdPtr, popupFlags) != 0; var r = ImGuiNative.BeginPopupContextItem(strIdPtr, popupFlags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -102,7 +102,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginPopupContextWindow(strIdPtr, popupFlags) != 0; var r = ImGuiNative.BeginPopupContextWindow(strIdPtr, popupFlags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -113,7 +113,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginPopupContextVoid(strIdPtr, popupFlags) != 0; var r = ImGuiNative.BeginPopupContextVoid(strIdPtr, popupFlags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -125,7 +125,7 @@ public static unsafe partial class ImGui
fixed (bool* openPtr = &open) fixed (bool* openPtr = &open)
{ {
var r = ImGuiNative.BeginPopupModal(namePtr, openPtr, flags) != 0; var r = ImGuiNative.BeginPopupModal(namePtr, openPtr, flags) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -135,7 +135,7 @@ public static unsafe partial class ImGui
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginPopupModal(namePtr, null, flags) != 0; var r = ImGuiNative.BeginPopupModal(namePtr, null, flags) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -145,7 +145,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginTabBar(strIdPtr, flags) != 0; var r = ImGuiNative.BeginTabBar(strIdPtr, flags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -157,7 +157,7 @@ public static unsafe partial class ImGui
fixed (bool* pOpenPtr = &pOpen) fixed (bool* pOpenPtr = &pOpen)
{ {
var r = ImGuiNative.BeginTabItem(labelPtr, pOpenPtr, flags) != 0; var r = ImGuiNative.BeginTabItem(labelPtr, pOpenPtr, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -167,7 +167,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginTabItem(labelPtr, null, flags) != 0; var r = ImGuiNative.BeginTabItem(labelPtr, null, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -179,7 +179,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.BeginTable(strIdPtr, column, flags, outerSize, innerWidth) != 0; var r = ImGuiNative.BeginTable(strIdPtr, column, flags, outerSize, innerWidth) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -189,7 +189,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.Button(labelPtr, size) != 0; var r = ImGuiNative.Button(labelPtr, size) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -200,7 +200,7 @@ public static unsafe partial class ImGui
fixed (bool* vPtr = &v) fixed (bool* vPtr = &v)
{ {
var r = ImGuiNative.Checkbox(labelPtr, vPtr) != 0; var r = ImGuiNative.Checkbox(labelPtr, vPtr) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -234,7 +234,7 @@ public static unsafe partial class ImGui
flags &= ~flagsValue; flags &= ~flagsValue;
} }
label.Dispose(); label.Recycle();
return pressed; return pressed;
} }
} }
@ -246,7 +246,7 @@ public static unsafe partial class ImGui
fixed (bool* visiblePtr = &visible) fixed (bool* visiblePtr = &visible)
{ {
var r = ImGuiNative.CollapsingHeader(labelPtr, visiblePtr, flags) != 0; var r = ImGuiNative.CollapsingHeader(labelPtr, visiblePtr, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -256,7 +256,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.CollapsingHeader(labelPtr, null, flags) != 0; var r = ImGuiNative.CollapsingHeader(labelPtr, null, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -268,7 +268,7 @@ public static unsafe partial class ImGui
fixed (byte* descIdPtr = &descId.GetPinnableNullTerminatedReference()) fixed (byte* descIdPtr = &descId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.ColorButton(descIdPtr, col, flags, size) != 0; var r = ImGuiNative.ColorButton(descIdPtr, col, flags, size) != 0;
descId.Dispose(); descId.Recycle();
return r; return r;
} }
} }
@ -277,7 +277,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* idPtr = &id.GetPinnableNullTerminatedReference()) fixed (byte* idPtr = &id.GetPinnableNullTerminatedReference())
ImGuiNative.Columns(count, idPtr, border ? (byte)1 : (byte)0); ImGuiNative.Columns(count, idPtr, border ? (byte)1 : (byte)0);
id.Dispose(); id.Recycle();
} }
public static bool DebugCheckVersionAndDataLayout( public static bool DebugCheckVersionAndDataLayout(
@ -294,7 +294,7 @@ public static unsafe partial class ImGui
szVec4, szVec4,
szDrawVert, szDrawVert,
szDrawIdx) != 0; szDrawIdx) != 0;
versionStr.Dispose(); versionStr.Recycle();
return r; return r;
} }
} }
@ -304,7 +304,7 @@ public static unsafe partial class ImGui
fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference()) fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference())
{ {
ImGuiNative.DebugTextEncoding(textPtr); 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)) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference("Filter (inc,-exc)"u8))
{ {
var r = ImGuiNative.Draw(self.Handle, labelPtr, width) != 0; var r = ImGuiNative.Draw(self.Handle, labelPtr, width) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -323,7 +323,7 @@ public static unsafe partial class ImGui
fixed (byte* defaultFilterPtr = &defaultFilter.GetPinnableNullTerminatedReference("\0"u8)) fixed (byte* defaultFilterPtr = &defaultFilter.GetPinnableNullTerminatedReference("\0"u8))
{ {
var r = ImGuiNative.ImGuiTextFilter(defaultFilterPtr); var r = ImGuiNative.ImGuiTextFilter(defaultFilterPtr);
defaultFilter.Dispose(); defaultFilter.Recycle();
return r; return r;
} }
} }
@ -342,7 +342,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.InvisibleButton(strIdPtr, size, flags) != 0; var r = ImGuiNative.InvisibleButton(strIdPtr, size, flags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -352,7 +352,7 @@ public static unsafe partial class ImGui
fixed (byte* typePtr = &type.GetPinnableNullTerminatedReference()) fixed (byte* typePtr = &type.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.IsDataType(self.Handle, typePtr) != 0; var r = ImGuiNative.IsDataType(self.Handle, typePtr) != 0;
type.Dispose(); type.Recycle();
return r; return r;
} }
} }
@ -362,7 +362,7 @@ public static unsafe partial class ImGui
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.IsPopupOpen(strIdPtr, flags) != 0; var r = ImGuiNative.IsPopupOpen(strIdPtr, flags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -371,21 +371,21 @@ public static unsafe partial class ImGui
{ {
fixed (byte* iniFilenamePtr = &iniFilename.GetPinnableNullTerminatedReference()) fixed (byte* iniFilenamePtr = &iniFilename.GetPinnableNullTerminatedReference())
ImGuiNative.LoadIniSettingsFromDisk(iniFilenamePtr); ImGuiNative.LoadIniSettingsFromDisk(iniFilenamePtr);
iniFilename.Dispose(); iniFilename.Recycle();
} }
public static void LoadIniSettingsFromMemory(ImU8String iniData) public static void LoadIniSettingsFromMemory(ImU8String iniData)
{ {
fixed (byte* iniDataPtr = iniData) fixed (byte* iniDataPtr = iniData)
ImGuiNative.LoadIniSettingsFromMemory(iniDataPtr, (nuint)iniData.Length); ImGuiNative.LoadIniSettingsFromMemory(iniDataPtr, (nuint)iniData.Length);
iniData.Dispose(); iniData.Recycle();
} }
public static void LogToFile(int autoOpenDepth = -1, ImU8String filename = default) public static void LogToFile(int autoOpenDepth = -1, ImU8String filename = default)
{ {
fixed (byte* filenamePtr = &filename.GetPinnableNullTerminatedReference()) fixed (byte* filenamePtr = &filename.GetPinnableNullTerminatedReference())
ImGuiNative.LogToFile(autoOpenDepth, filenamePtr); ImGuiNative.LogToFile(autoOpenDepth, filenamePtr);
filename.Dispose(); filename.Recycle();
} }
public static bool MenuItem( public static bool MenuItem(
@ -399,8 +399,8 @@ public static unsafe partial class ImGui
shortcutPtr, shortcutPtr,
selected ? (byte)1 : (byte)0, selected ? (byte)1 : (byte)0,
enabled ? (byte)1 : (byte)0) != 0; enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
shortcut.Dispose(); shortcut.Recycle();
return r; return r;
} }
} }
@ -412,8 +412,8 @@ public static unsafe partial class ImGui
fixed (bool* selectedPtr = &selected) fixed (bool* selectedPtr = &selected)
{ {
var r = ImGuiNative.MenuItem(labelPtr, shortcutPtr, selectedPtr, enabled ? (byte)1 : (byte)0) != 0; var r = ImGuiNative.MenuItem(labelPtr, shortcutPtr, selectedPtr, enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
shortcut.Dispose(); shortcut.Recycle();
return r; return r;
} }
} }
@ -424,7 +424,7 @@ public static unsafe partial class ImGui
fixed (bool* selectedPtr = &selected) fixed (bool* selectedPtr = &selected)
{ {
var r = ImGuiNative.MenuItem(labelPtr, null, selectedPtr, enabled ? (byte)1 : (byte)0) != 0; var r = ImGuiNative.MenuItem(labelPtr, null, selectedPtr, enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -438,7 +438,7 @@ public static unsafe partial class ImGui
null, null,
selected ? (byte)1 : (byte)0, selected ? (byte)1 : (byte)0,
enabled ? (byte)1 : (byte)0) != 0; enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -447,7 +447,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
ImGuiNative.OpenPopup(strIdPtr, popupFlags); ImGuiNative.OpenPopup(strIdPtr, popupFlags);
strId.Dispose(); strId.Recycle();
} }
public static void OpenPopup(uint id, ImGuiPopupFlags popupFlags = ImGuiPopupFlags.None) => 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()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
ImGuiNative.OpenPopupOnItemClick(strIdPtr, popupFlags); ImGuiNative.OpenPopupOnItemClick(strIdPtr, popupFlags);
strId.Dispose(); strId.Recycle();
} }
public static void ProgressBar(float fraction, Vector2 sizeArg, ImU8String overlay = default) public static void ProgressBar(float fraction, Vector2 sizeArg, ImU8String overlay = default)
{ {
fixed (byte* overlayPtr = &overlay.GetPinnableNullTerminatedReference()) fixed (byte* overlayPtr = &overlay.GetPinnableNullTerminatedReference())
ImGuiNative.ProgressBar(fraction, sizeArg, overlayPtr); ImGuiNative.ProgressBar(fraction, sizeArg, overlayPtr);
overlay.Dispose(); overlay.Recycle();
} }
public static void ProgressBar(float fraction, ImU8String overlay = default) public static void ProgressBar(float fraction, ImU8String overlay = default)
{ {
fixed (byte* overlayPtr = &overlay.GetPinnableNullTerminatedReference()) fixed (byte* overlayPtr = &overlay.GetPinnableNullTerminatedReference())
ImGuiNative.ProgressBar(fraction, new(-float.MinValue, 0), overlayPtr); ImGuiNative.ProgressBar(fraction, new(-float.MinValue, 0), overlayPtr);
overlay.Dispose(); overlay.Recycle();
} }
public static bool RadioButton(ImU8String label, bool active) public static bool RadioButton(ImU8String label, bool active)
@ -480,7 +480,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.RadioButton(labelPtr, active ? (byte)1 : (byte)0) != 0; var r = ImGuiNative.RadioButton(labelPtr, active ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -511,7 +511,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.Selectable(labelPtr, selected ? (byte)1 : (byte)0, flags, size) != 0; var r = ImGuiNative.Selectable(labelPtr, selected ? (byte)1 : (byte)0, flags, size) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -524,7 +524,7 @@ public static unsafe partial class ImGui
fixed (bool* selectedPtr = &selected) fixed (bool* selectedPtr = &selected)
{ {
var r = ImGuiNative.Selectable(labelPtr, selectedPtr, flags, size) != 0; var r = ImGuiNative.Selectable(labelPtr, selectedPtr, flags, size) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -533,7 +533,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference()) fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference())
ImGuiNative.SetClipboardText(textPtr); ImGuiNative.SetClipboardText(textPtr);
text.Dispose(); text.Recycle();
} }
public static bool SetDragDropPayload(ImU8String type, ReadOnlySpan<byte> data, ImGuiCond cond) public static bool SetDragDropPayload(ImU8String type, ReadOnlySpan<byte> data, ImGuiCond cond)
@ -542,7 +542,7 @@ public static unsafe partial class ImGui
fixed (byte* dataPtr = data) fixed (byte* dataPtr = data)
{ {
var r = ImGuiNative.SetDragDropPayload(typePtr, dataPtr, (nuint)data.Length, cond) != 0; var r = ImGuiNative.SetDragDropPayload(typePtr, dataPtr, (nuint)data.Length, cond) != 0;
type.Dispose(); type.Recycle();
return r; return r;
} }
} }
@ -551,7 +551,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* tabItemPtr = &tabOrDockedWindowLabel.GetPinnableNullTerminatedReference()) fixed (byte* tabItemPtr = &tabOrDockedWindowLabel.GetPinnableNullTerminatedReference())
ImGuiNative.SetTabItemClosed(tabItemPtr); ImGuiNative.SetTabItemClosed(tabItemPtr);
tabOrDockedWindowLabel.Dispose(); tabOrDockedWindowLabel.Recycle();
} }
public static void SetWindowCollapsed(bool collapsed, ImGuiCond cond = ImGuiCond.None) => 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()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
ImGuiNative.SetWindowCollapsed(namePtr, collapsed ? (byte)1 : (byte)0, cond); ImGuiNative.SetWindowCollapsed(namePtr, collapsed ? (byte)1 : (byte)0, cond);
name.Dispose(); name.Recycle();
} }
/// <summary>Sets the current window to be focused / top-most.</summary> /// <summary>Sets the current window to be focused / top-most.</summary>
@ -574,7 +574,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
ImGuiNative.SetWindowFocus(namePtr); ImGuiNative.SetWindowFocus(namePtr);
name.Dispose(); name.Recycle();
} }
/// <summary>Removes focus from any window.</summary> /// <summary>Removes focus from any window.</summary>
@ -587,7 +587,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
ImGuiNative.SetWindowPos(namePtr, pos, cond); ImGuiNative.SetWindowPos(namePtr, pos, cond);
name.Dispose(); name.Recycle();
} }
public static void SetWindowSize(Vector2 size, ImGuiCond cond = ImGuiCond.None) => 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()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
ImGuiNative.SetWindowSize(namePtr, size, cond); ImGuiNative.SetWindowSize(namePtr, size, cond);
name.Dispose(); name.Recycle();
} }
public static void ShowFontSelector(ImU8String label) public static void ShowFontSelector(ImU8String label)
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiNative.ShowFontSelector(labelPtr); ImGuiNative.ShowFontSelector(labelPtr);
label.Dispose(); label.Recycle();
} }
public static bool ShowStyleSelector(ImU8String label) public static bool ShowStyleSelector(ImU8String label)
@ -612,7 +612,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.ShowStyleSelector(labelPtr) != 0; var r = ImGuiNative.ShowStyleSelector(labelPtr) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -622,7 +622,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.SmallButton(labelPtr) != 0; var r = ImGuiNative.SmallButton(labelPtr) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -632,7 +632,7 @@ public static unsafe partial class ImGui
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiNative.TabItemButton(labelPtr, flags) != 0; var r = ImGuiNative.TabItemButton(labelPtr, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -641,7 +641,7 @@ public static unsafe partial class ImGui
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiNative.TableHeader(labelPtr); ImGuiNative.TableHeader(labelPtr);
label.Dispose(); label.Recycle();
} }
public static void TableSetupColumn( public static void TableSetupColumn(
@ -650,14 +650,14 @@ public static unsafe partial class ImGui
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiNative.TableSetupColumn(labelPtr, flags, initWidthOrWeight, userId); ImGuiNative.TableSetupColumn(labelPtr, flags, initWidthOrWeight, userId);
label.Dispose(); label.Recycle();
} }
public static void TreePush(ImU8String strId) public static void TreePush(ImU8String strId)
{ {
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
ImGuiNative.TreePush(strIdPtr); ImGuiNative.TreePush(strIdPtr);
strId.Dispose(); strId.Recycle();
} }
public static void TreePush(nint ptrId) => ImGuiNative.TreePush((void*)ptrId); public static void TreePush(nint ptrId) => ImGuiNative.TreePush((void*)ptrId);
@ -670,7 +670,7 @@ public static unsafe partial class ImGui
fixed (byte* prefixPtr = prefix) fixed (byte* prefixPtr = prefix)
{ {
ImGuiNative.TextUnformatted(prefixPtr, prefixPtr + prefix.Length); 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()) fixed (byte* floatPtr = &floatFormat.GetPinnableNullTerminatedReference())
{ {
ImGuiNative.Value(prefixPtr, value, floatPtr); ImGuiNative.Value(prefixPtr, value, floatPtr);
prefix.Dispose(); prefix.Recycle();
floatFormat.Dispose(); floatFormat.Recycle();
} }
} }
} }

View file

@ -12,7 +12,7 @@ public unsafe partial class ImGuiP
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.ArrowButtonEx(strIdPtr, dir, sizeArg, flags) != 0; var r = ImGuiPNative.ArrowButtonEx(strIdPtr, dir, sizeArg, flags) != 0;
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -22,7 +22,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.BeginChildEx(namePtr, id, sizeArg, border ? (byte)1 : (byte)0, flags) != 0; var r = ImGuiPNative.BeginChildEx(namePtr, id, sizeArg, border ? (byte)1 : (byte)0, flags) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -31,7 +31,7 @@ public unsafe partial class ImGuiP
{ {
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
ImGuiPNative.BeginColumns(strIdPtr, count, flags); ImGuiPNative.BeginColumns(strIdPtr, count, flags);
strId.Dispose(); strId.Recycle();
} }
public static bool BeginMenuEx(ImU8String label, ImU8String icon = default, bool enabled = true) 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()) fixed (byte* iconPtr = &icon.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.BeginMenuEx(labelPtr, iconPtr, enabled ? (byte)1 : (byte)0) != 0; var r = ImGuiPNative.BeginMenuEx(labelPtr, iconPtr, enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
icon.Dispose(); icon.Recycle();
return r; return r;
} }
} }
@ -53,7 +53,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.BeginTableEx(namePtr, id, columnsCount, flags, outerSize, innerWidth) != 0; var r = ImGuiPNative.BeginTableEx(namePtr, id, columnsCount, flags, outerSize, innerWidth) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -64,7 +64,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.BeginViewportSideBar(namePtr, viewport, dir, size, windowFlags) != 0; var r = ImGuiPNative.BeginViewportSideBar(namePtr, viewport, dir, size, windowFlags) != 0;
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -75,7 +75,7 @@ public unsafe partial class ImGuiP
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.ButtonEx(labelPtr, sizeArg, flags) != 0; var r = ImGuiPNative.ButtonEx(labelPtr, sizeArg, flags) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -97,7 +97,7 @@ public unsafe partial class ImGuiP
fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference()) fixed (byte* textPtr = &text.GetPinnableNullTerminatedReference())
fixed (float* colPtr = col) fixed (float* colPtr = col)
ImGuiPNative.ColorTooltip(textPtr, colPtr, flags); ImGuiPNative.ColorTooltip(textPtr, colPtr, flags);
text.Dispose(); text.Recycle();
} }
public static ImGuiWindowSettingsPtr CreateNewWindowSettings(ImU8String name) public static ImGuiWindowSettingsPtr CreateNewWindowSettings(ImU8String name)
@ -105,7 +105,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.CreateNewWindowSettings(namePtr); var r = ImGuiPNative.CreateNewWindowSettings(namePtr);
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -123,8 +123,8 @@ public unsafe partial class ImGuiP
fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.DataTypeApplyFromText(bufPtr, dataType, &data, formatPtr) != 0; var r = ImGuiPNative.DataTypeApplyFromText(bufPtr, dataType, &data, formatPtr) != 0;
format.Dispose(); format.Recycle();
buf.Dispose(); buf.Recycle();
return r; return r;
} }
} }
@ -133,7 +133,7 @@ public unsafe partial class ImGuiP
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiPNative.DebugNodeDockNode(node, labelPtr); ImGuiPNative.DebugNodeDockNode(node, labelPtr);
label.Dispose(); label.Recycle();
} }
public static void DebugNodeDrawList( public static void DebugNodeDrawList(
@ -141,28 +141,28 @@ public unsafe partial class ImGuiP
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiPNative.DebugNodeDrawList(window, viewport, drawList, labelPtr); ImGuiPNative.DebugNodeDrawList(window, viewport, drawList, labelPtr);
label.Dispose(); label.Recycle();
} }
public static void DebugNodeStorage(ImGuiStoragePtr storage, ImU8String label) public static void DebugNodeStorage(ImGuiStoragePtr storage, ImU8String label)
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiPNative.DebugNodeStorage(storage, labelPtr); ImGuiPNative.DebugNodeStorage(storage, labelPtr);
label.Dispose(); label.Recycle();
} }
public static void DebugNodeTabBar(ImGuiTabBarPtr tabBar, ImU8String label) public static void DebugNodeTabBar(ImGuiTabBarPtr tabBar, ImU8String label)
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiPNative.DebugNodeTabBar(tabBar, labelPtr); ImGuiPNative.DebugNodeTabBar(tabBar, labelPtr);
label.Dispose(); label.Recycle();
} }
public static void DebugNodeWindow(ImGuiWindowPtr window, ImU8String label) public static void DebugNodeWindow(ImGuiWindowPtr window, ImU8String label)
{ {
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiPNative.DebugNodeWindow(window, labelPtr); ImGuiPNative.DebugNodeWindow(window, labelPtr);
label.Dispose(); label.Recycle();
} }
public static void DebugNodeWindowsList(scoped in ImVector<ImGuiWindowPtr> windows, ImU8String label) public static void DebugNodeWindowsList(scoped in ImVector<ImGuiWindowPtr> windows, ImU8String label)
@ -170,7 +170,7 @@ public unsafe partial class ImGuiP
fixed (ImVector<ImGuiWindowPtr>* windowsPtr = &windows) fixed (ImVector<ImGuiWindowPtr>* windowsPtr = &windows)
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
ImGuiPNative.DebugNodeWindowsList(windowsPtr, labelPtr); ImGuiPNative.DebugNodeWindowsList(windowsPtr, labelPtr);
label.Dispose(); label.Recycle();
} }
public static void DockBuilderCopyWindowSettings(ImU8String srcName, ImU8String dstName) public static void DockBuilderCopyWindowSettings(ImU8String srcName, ImU8String dstName)
@ -178,15 +178,15 @@ public unsafe partial class ImGuiP
fixed (byte* srcNamePtr = &srcName.GetPinnableNullTerminatedReference()) fixed (byte* srcNamePtr = &srcName.GetPinnableNullTerminatedReference())
fixed (byte* dstNamePtr = &dstName.GetPinnableNullTerminatedReference()) fixed (byte* dstNamePtr = &dstName.GetPinnableNullTerminatedReference())
ImGuiPNative.DockBuilderCopyWindowSettings(srcNamePtr, dstNamePtr); ImGuiPNative.DockBuilderCopyWindowSettings(srcNamePtr, dstNamePtr);
srcName.Dispose(); srcName.Recycle();
dstName.Dispose(); dstName.Recycle();
} }
public static void DockBuilderDockWindow(ImU8String windowName, uint nodeId) public static void DockBuilderDockWindow(ImU8String windowName, uint nodeId)
{ {
fixed (byte* windowNamePtr = &windowName.GetPinnableNullTerminatedReference()) fixed (byte* windowNamePtr = &windowName.GetPinnableNullTerminatedReference())
ImGuiPNative.DockBuilderDockWindow(windowNamePtr, nodeId); ImGuiPNative.DockBuilderDockWindow(windowNamePtr, nodeId);
windowName.Dispose(); windowName.Recycle();
} }
public static bool DragBehavior( public static bool DragBehavior(
@ -196,7 +196,7 @@ public unsafe partial class ImGuiP
fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference()) fixed (byte* formatPtr = &format.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.DragBehavior(id, dataType, pV, vSpeed, pMin, pMax, formatPtr, flags) != 0; var r = ImGuiPNative.DragBehavior(id, dataType, pV, vSpeed, pMin, pMax, formatPtr, flags) != 0;
format.Dispose(); format.Recycle();
return r; return r;
} }
} }
@ -206,7 +206,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.FindOrCreateWindowSettings(namePtr); var r = ImGuiPNative.FindOrCreateWindowSettings(namePtr);
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -216,7 +216,7 @@ public unsafe partial class ImGuiP
fixed (byte* typeNamePtr = &typeName.GetPinnableNullTerminatedReference()) fixed (byte* typeNamePtr = &typeName.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.FindSettingsHandler(typeNamePtr); var r = ImGuiPNative.FindSettingsHandler(typeNamePtr);
typeName.Dispose(); typeName.Recycle();
return r; return r;
} }
} }
@ -226,7 +226,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.FindWindowByName(namePtr); var r = ImGuiPNative.FindWindowByName(namePtr);
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -236,7 +236,7 @@ public unsafe partial class ImGuiP
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.GetColumnsID(strIdPtr, count); var r = ImGuiPNative.GetColumnsID(strIdPtr, count);
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -246,7 +246,7 @@ public unsafe partial class ImGuiP
fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference()) fixed (byte* strIdPtr = &strId.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.GetIDWithSeed(strIdPtr, strIdPtr + strId.Length, seed); var r = ImGuiPNative.GetIDWithSeed(strIdPtr, strIdPtr + strId.Length, seed);
strId.Dispose(); strId.Recycle();
return r; return r;
} }
} }
@ -259,8 +259,8 @@ public unsafe partial class ImGuiP
fixed (nuint* outFileSizePtr = &outFileSize) fixed (nuint* outFileSizePtr = &outFileSize)
{ {
var r = ImGuiPNative.ImFileLoadToMemory(filenamePtr, modePtr, outFileSizePtr, paddingBytes); var r = ImGuiPNative.ImFileLoadToMemory(filenamePtr, modePtr, outFileSizePtr, paddingBytes);
filename.Dispose(); filename.Recycle();
mode.Dispose(); mode.Recycle();
return r; return r;
} }
} }
@ -271,8 +271,8 @@ public unsafe partial class ImGuiP
fixed (byte* modePtr = &mode.GetPinnableNullTerminatedReference()) fixed (byte* modePtr = &mode.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.ImFileLoadToMemory(filenamePtr, modePtr, null, paddingBytes); var r = ImGuiPNative.ImFileLoadToMemory(filenamePtr, modePtr, null, paddingBytes);
filename.Dispose(); filename.Recycle();
mode.Dispose(); mode.Recycle();
return r; return r;
} }
} }
@ -283,8 +283,8 @@ public unsafe partial class ImGuiP
fixed (byte* modePtr = &mode.GetPinnableNullTerminatedReference()) fixed (byte* modePtr = &mode.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.ImFileOpen(filenamePtr, modePtr); var r = ImGuiPNative.ImFileOpen(filenamePtr, modePtr);
filename.Dispose(); filename.Recycle();
mode.Dispose(); mode.Recycle();
return r; return r;
} }
} }
@ -339,7 +339,7 @@ public unsafe partial class ImGuiP
{ {
fixed (byte* fmtPtr = &fmt.GetPinnableNullTerminatedReference()) fixed (byte* fmtPtr = &fmt.GetPinnableNullTerminatedReference())
ImGuiPNative.ImFormatStringToTempBuffer(outBuf, outBufEnd, fmtPtr); ImGuiPNative.ImFormatStringToTempBuffer(outBuf, outBufEnd, fmtPtr);
fmt.Dispose(); fmt.Recycle();
} }
public static ImGuiWindowPtr ImGuiWindow(ImGuiContextPtr context, ImU8String name) public static ImGuiWindowPtr ImGuiWindow(ImGuiContextPtr context, ImU8String name)
@ -347,7 +347,7 @@ public unsafe partial class ImGuiP
fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference()) fixed (byte* namePtr = &name.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.ImGuiWindow(context, namePtr); var r = ImGuiPNative.ImGuiWindow(context, namePtr);
name.Dispose(); name.Recycle();
return r; return r;
} }
} }
@ -386,9 +386,9 @@ public unsafe partial class ImGuiP
shortcutPtr, shortcutPtr,
selected ? (byte)1 : (byte)0, selected ? (byte)1 : (byte)0,
enabled ? (byte)1 : (byte)0) != 0; enabled ? (byte)1 : (byte)0) != 0;
label.Dispose(); label.Recycle();
icon.Dispose(); icon.Recycle();
shortcut.Dispose(); shortcut.Recycle();
return r; return r;
} }
} }
@ -397,7 +397,7 @@ public unsafe partial class ImGuiP
{ {
fixed (byte* typeNamePtr = &typeName.GetPinnableNullTerminatedReference()) fixed (byte* typeNamePtr = &typeName.GetPinnableNullTerminatedReference())
ImGuiPNative.RemoveSettingsHandler(typeNamePtr); ImGuiPNative.RemoveSettingsHandler(typeNamePtr);
typeName.Dispose(); typeName.Recycle();
} }
public static bool SliderBehavior<T>( public static bool SliderBehavior<T>(
@ -418,7 +418,7 @@ public unsafe partial class ImGuiP
formatPtr, formatPtr,
flags, flags,
outGrabBb) != 0; outGrabBb) != 0;
format.Dispose(); format.Recycle();
return r; return r;
} }
} }
@ -440,7 +440,7 @@ public unsafe partial class ImGuiP
fixed (bool* openPtr = &open) fixed (bool* openPtr = &open)
{ {
var r = ImGuiPNative.TabItemEx(tabBar, labelPtr, openPtr, flags, dockedWindow) != 0; var r = ImGuiPNative.TabItemEx(tabBar, labelPtr, openPtr, flags, dockedWindow) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -466,7 +466,7 @@ public unsafe partial class ImGuiP
textClippedPtr); textClippedPtr);
} }
label.Dispose(); label.Recycle();
} }
public static bool TempInputScalar<T>( public static bool TempInputScalar<T>(
@ -479,7 +479,7 @@ public unsafe partial class ImGuiP
fixed (T* dataPtr = &data) fixed (T* dataPtr = &data)
{ {
var r = ImGuiPNative.TempInputScalar(bb, id, labelPtr, dataType, dataPtr, formatPtr, &min, &max) != 0; var r = ImGuiPNative.TempInputScalar(bb, id, labelPtr, dataType, dataPtr, formatPtr, &min, &max) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }
@ -489,7 +489,7 @@ public unsafe partial class ImGuiP
fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference()) fixed (byte* labelPtr = &label.GetPinnableNullTerminatedReference())
{ {
var r = ImGuiPNative.TreeNodeBehavior(id, flags, labelPtr, labelPtr + label.Length) != 0; var r = ImGuiPNative.TreeNodeBehavior(id, flags, labelPtr, labelPtr + label.Length) != 0;
label.Dispose(); label.Recycle();
return r; return r;
} }
} }

View file

@ -27,8 +27,8 @@ public static unsafe partial class ImGuiP
scaleMin, scaleMin,
scaleMax, scaleMax,
frameSize); frameSize);
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
return r; return r;
} }
} }
@ -59,8 +59,8 @@ public static unsafe partial class ImGuiP
scaleMin, scaleMin,
scaleMax, scaleMax,
frameSize); frameSize);
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
return r; return r;
} }
} }
@ -91,8 +91,8 @@ public static unsafe partial class ImGuiP
scaleMin, scaleMin,
scaleMax, scaleMax,
frameSize); frameSize);
label.Dispose(); label.Recycle();
overlayText.Dispose(); overlayText.Recycle();
return r; return r;
} }
} }

View file

@ -13,7 +13,7 @@ public static unsafe partial class ImGuiP
ImGui.append(&g->DebugLogBuf, text.Span); ImGui.append(&g->DebugLogBuf, text.Span);
if ((g->DebugLogFlags & ImGuiDebugLogFlags.OutputToTty) != ImGuiDebugLogFlags.None) if ((g->DebugLogFlags & ImGuiDebugLogFlags.OutputToTty) != ImGuiDebugLogFlags.None)
Debug.Write(text.ToString()); Debug.Write(text.ToString());
text.Dispose(); text.Recycle();
} }
public static int FindRenderedTextEnd( public static int FindRenderedTextEnd(
@ -35,7 +35,7 @@ public static unsafe partial class ImGuiP
FindRenderedTextEnd(textBuf.Span, out var beforeBytes, out var afterBytes); FindRenderedTextEnd(textBuf.Span, out var beforeBytes, out var afterBytes);
before = text[..Encoding.UTF8.GetCharCount(beforeBytes)]; before = text[..Encoding.UTF8.GetCharCount(beforeBytes)];
after = text[before.Length..]; after = text[before.Length..];
textBuf.Dispose(); textBuf.Recycle();
return before.Length; return before.Length;
} }
@ -48,7 +48,7 @@ public static unsafe partial class ImGuiP
var g = ImGui.GetCurrentContext(); var g = ImGui.GetCurrentContext();
if (g.DebugHookIdInfo == id) if (g.DebugHookIdInfo == id)
DebugHookIdInfo(id, (ImGuiDataType)ImGuiDataTypePrivate.String, strPtr, strPtr + str.Length); DebugHookIdInfo(id, (ImGuiDataType)ImGuiDataTypePrivate.String, strPtr, strPtr + str.Length);
str.Dispose(); str.Recycle();
return id; return id;
} }
} }
@ -66,7 +66,7 @@ public static unsafe partial class ImGuiP
fixed (byte* ptr = data) fixed (byte* ptr = data)
{ {
var res = ImGuiPNative.ImHashStr(ptr, (nuint)data.Length, seed); var res = ImGuiPNative.ImHashStr(ptr, (nuint)data.Length, seed);
data.Dispose(); data.Recycle();
return res; return res;
} }
} }
@ -135,14 +135,14 @@ public static unsafe partial class ImGuiP
fixed (Vector2* refPosPtr = &refPos) fixed (Vector2* refPosPtr = &refPos)
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
ImGuiPNative.LogRenderedText(refPosPtr, textPtr, textPtr + text.Length); ImGuiPNative.LogRenderedText(refPosPtr, textPtr, textPtr + text.Length);
text.Dispose(); text.Recycle();
} }
public static void RenderText(Vector2 pos, ImU8String text, bool hideTextAfterHash = true) public static void RenderText(Vector2 pos, ImU8String text, bool hideTextAfterHash = true)
{ {
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
ImGuiPNative.RenderText(pos, textPtr, textPtr + text.Length, hideTextAfterHash ? (byte)1 : (byte)0); ImGuiPNative.RenderText(pos, textPtr, textPtr + text.Length, hideTextAfterHash ? (byte)1 : (byte)0);
text.Dispose(); text.Recycle();
} }
public static void RenderTextWrapped( public static void RenderTextWrapped(
@ -150,7 +150,7 @@ public static unsafe partial class ImGuiP
{ {
fixed (byte* textPtr = text) fixed (byte* textPtr = text)
ImGuiPNative.RenderTextWrapped(pos, textPtr, textPtr + text.Length, wrapWidth); ImGuiPNative.RenderTextWrapped(pos, textPtr, textPtr + text.Length, wrapWidth);
text.Dispose(); text.Recycle();
} }
public static void RenderTextClipped( public static void RenderTextClipped(
@ -169,7 +169,7 @@ public static unsafe partial class ImGuiP
textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null, textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null,
align, align,
clipRect.HasValue ? &clipRectOrDefault : null); clipRect.HasValue ? &clipRectOrDefault : null);
text.Dispose(); text.Recycle();
} }
public static void RenderTextClippedEx( public static void RenderTextClippedEx(
@ -189,7 +189,7 @@ public static unsafe partial class ImGuiP
textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null, textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null,
align, align,
clipRect.HasValue ? &clipRectOrDefault : null); clipRect.HasValue ? &clipRectOrDefault : null);
text.Dispose(); text.Recycle();
} }
public static void RenderTextEllipsis( public static void RenderTextEllipsis(
@ -207,7 +207,7 @@ public static unsafe partial class ImGuiP
textPtr, textPtr,
textPtr + text.Length, textPtr + text.Length,
textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null); textSizeIfKnown.HasValue ? &textSizeIfKnownOrDefault : null);
text.Dispose(); text.Recycle();
} }
public static void TextEx(ReadOnlySpan<byte> text, ImGuiTextFlags flags) public static void TextEx(ReadOnlySpan<byte> text, ImGuiTextFlags flags)

View file

@ -8,7 +8,7 @@ using System.Text.Unicode;
namespace Dalamud.Bindings.ImGui; namespace Dalamud.Bindings.ImGui;
[InterpolatedStringHandler] [InterpolatedStringHandler]
public ref struct ImU8String : IDisposable public ref struct ImU8String
{ {
public const int AllocFreeBufferSize = 512; public const int AllocFreeBufferSize = 512;
private const int MinimumRentSize = AllocFreeBufferSize * 2; private const int MinimumRentSize = AllocFreeBufferSize * 2;
@ -247,7 +247,7 @@ public ref struct ImU8String : IDisposable
this.externalFirstByte = ref Unsafe.NullRef<byte>(); this.externalFirstByte = ref Unsafe.NullRef<byte>();
} }
public void Dispose() public void Recycle()
{ {
if (this.rentedBuffer is { } buf) if (this.rentedBuffer is { } buf)
{ {
@ -260,7 +260,7 @@ public ref struct ImU8String : IDisposable
{ {
if (!this.IsNull) if (!this.IsNull)
{ {
other.Dispose(); other.Recycle();
var res = this; var res = this;
this = default; this = default;
return res; return res;