mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-14 17:07:01 +00:00
Misc: IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value.
This commit is contained in:
parent
660c157880
commit
9117632bf0
@ -41,7 +41,7 @@ VERSION 1.61 WIP
|
||||
|
||||
Breaking Changes:
|
||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||
- ...
|
||||
- Misc: IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value.
|
||||
|
||||
Other Changes:
|
||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||
@ -168,6 +168,7 @@ Other Changes:
|
||||
- Misc: ImVec2: added [] operator. This is becoming desirable for some code working of either axes independently. Better adding it sooner than later.
|
||||
- Misc: NewFrame(): Added an assert to detect incorrect filling of the io.KeyMap[] array earlier. (#1555)
|
||||
- Misc: Added IM_OFFSETOF() helper in imgui.h (previously was in imgui_internal.h)
|
||||
- Misc: Added IM_NEW(), IM_DELETE() helpers in imgui.h (previously were in imgui_internal.h)
|
||||
- Misc: Added obsolete redirection function GetItemsLineHeightWithSpacing() (which redirects to GetFrameHeightWithSpacing()), as intended and stated in docs of 1.53.
|
||||
- Misc: Added misc/natvis/imgui.natvis for visual studio debugger users to easily visualize imgui internal types. Added to examples projects.
|
||||
- Misc: Added IMGUI_USER_CONFIG to define a custom configuration filename. (#255, #1573, #1144, #41)
|
||||
|
@ -262,6 +262,7 @@
|
||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2018/04/09 (1.61) - IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value.
|
||||
- 2018/03/20 (1.60) - Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, _not_ used by core and only honored by some binding ahead of merging the Nav branch).
|
||||
- 2018/03/12 (1.60) - Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered as the closing cross uses regular button colors now.
|
||||
- 2018/03/08 (1.60) - Changed ImFont::DisplayOffset.y to default to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer. If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically.
|
||||
@ -3670,6 +3671,7 @@ void ImGui::Shutdown(ImGuiContext* context)
|
||||
// The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)
|
||||
if (g.IO.Fonts && g.FontAtlasOwnedByContext)
|
||||
IM_DELETE(g.IO.Fonts);
|
||||
g.IO.Fonts = NULL;
|
||||
|
||||
// Cleanup of other data are conditional on actually having initialize ImGui.
|
||||
if (!g.Initialized)
|
||||
@ -3690,8 +3692,6 @@ void ImGui::Shutdown(ImGuiContext* context)
|
||||
g.HoveredRootWindow = NULL;
|
||||
g.ActiveIdWindow = NULL;
|
||||
g.MovingWindow = NULL;
|
||||
for (int i = 0; i < g.SettingsWindows.Size; i++)
|
||||
IM_DELETE(g.SettingsWindows[i].Name);
|
||||
g.ColorModifiers.clear();
|
||||
g.StyleModifiers.clear();
|
||||
g.FontStack.clear();
|
||||
@ -3704,6 +3704,8 @@ void ImGui::Shutdown(ImGuiContext* context)
|
||||
g.InputTextState.InitialText.clear();
|
||||
g.InputTextState.TempTextBuffer.clear();
|
||||
|
||||
for (int i = 0; i < g.SettingsWindows.Size; i++)
|
||||
IM_DELETE(g.SettingsWindows[i].Name);
|
||||
g.SettingsWindows.clear();
|
||||
g.SettingsHandlers.clear();
|
||||
|
||||
@ -3714,6 +3716,7 @@ void ImGui::Shutdown(ImGuiContext* context)
|
||||
}
|
||||
if (g.LogClipboard)
|
||||
IM_DELETE(g.LogClipboard);
|
||||
g.LogClipboard = NULL;
|
||||
|
||||
g.Initialized = false;
|
||||
}
|
||||
|
2
imgui.h
2
imgui.h
@ -1212,7 +1212,7 @@ inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; }
|
||||
inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symetrical new()
|
||||
#define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR)
|
||||
#define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
|
||||
template<typename T> void IM_DELETE(T*& p) { if (p) { p->~T(); ImGui::MemFree(p); p = NULL; } }
|
||||
template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
|
||||
|
||||
// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
||||
// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");
|
||||
|
Loading…
Reference in New Issue
Block a user