mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-21 22:06:31 +00:00
Tables: fixed TableGcCompactSettings() not invalidating bound offset. A crash could in theory be triggered if clicking "Gc All" after saved tables have reduced column count.
Tested by "table_settings_5"
This commit is contained in:
2
imgui.h
2
imgui.h
@@ -30,7 +30,7 @@
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.92.9 WIP"
|
||||
#define IMGUI_VERSION_NUM 19283
|
||||
#define IMGUI_VERSION_NUM 19284
|
||||
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
|
||||
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
|
||||
|
||||
|
||||
@@ -4110,7 +4110,7 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTableTempData* temp_data)
|
||||
temp_data->LastTimeActive = -1.0f;
|
||||
}
|
||||
|
||||
// Compact and remove unused settings data (currently only used by TestEngine)
|
||||
// Compact and remove unused or resize settings data (only TestEngine mark unused, but resizing table down can lead to compaction)
|
||||
void ImGui::TableGcCompactSettings()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -4126,6 +4126,9 @@ void ImGui::TableGcCompactSettings()
|
||||
if (settings->ID != 0)
|
||||
memcpy(new_chunk_stream.alloc_chunk(TableSettingsCalcChunkSize(settings->ColumnsCount)), settings, TableSettingsCalcChunkSize(settings->ColumnsCount));
|
||||
g.SettingsTables.swap(new_chunk_stream);
|
||||
for (int table_n = 0; table_n < g.Tables.GetMapSize(); table_n++)
|
||||
if (ImGuiTable* table = g.Tables.TryGetMapData(table_n))
|
||||
table->SettingsOffset = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user