Kaynağa Gözat

ImDrawListSplitter: Fixed memory leak when using low-level split api (was not affecting ImDrawList api, also this type was added in 1.71 and not advertised as a public-facing feature).

omar 6 yıl önce
ebeveyn
işleme
41e2d4b5ae
2 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 3 1
      docs/CHANGELOG.txt
  2. 2 1
      imgui.h

+ 3 - 1
docs/CHANGELOG.txt

@@ -46,8 +46,10 @@ Other Changes:
 - Word-wrapping: Fixed overzealous word-wrapping when glyph edge lands exactly on the limit. Because
   of this, auto-fitting exactly unwrapped text would make it wrap. (fixes initial 1.15 commit, 78645a7d).
 - ImDrawList: Fixed CloneOutput() helper crashing. (#1860) [@gviot]
-- ImDrawListSlitter, ImDrawList::ChannelsSplit(), : Fixed an issue with merging draw commands between
+- ImDrawList::ChannelsSplit(), ImDrawListSplitter: Fixed an issue with merging draw commands between
   channel 0 and 1. (#2624)
+- ImDrawListSplitter: Fixed memory leak when using low-level split api (was not affecting ImDrawList api,
+  also this type was added in 1.71 and not advertised as a public-facing feature).
 - Backends: SDL2: Added dummy ImGui_ImplSDL2_InitForD3D() function to make D3D support more visible.
   (#2482, #2632) [@josiahmanson]
 - Examples: Added SDL2+DirectX11 example application. (#2632, #2612, #2482) [@vincenthamm]

+ 2 - 1
imgui.h

@@ -1822,7 +1822,8 @@ struct ImDrawListSplitter
     int                         _Count;      // Number of active channels (1+)
     ImVector<ImDrawChannel>     _Channels;   // Draw channels (not resized down so _Count might be < Channels.Size)
 
-    inline ImDrawListSplitter() { Clear(); }
+    inline ImDrawListSplitter()  { Clear(); }
+    inline ~ImDrawListSplitter() { ClearFreeMemory(); }
     inline void                 Clear() { _Current = 0; _Count = 1; } // Do not clear Channels[] so our allocations are reused next frame
     IMGUI_API void              ClearFreeMemory();
     IMGUI_API void              Split(ImDrawList* draw_list, int count);