mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 04:58:47 +02:00
Internals: Settings: Added ReadCloseFn to allow handlers to sanitize data on a per-entry basis.
This commit is contained in:
@ -3732,6 +3732,10 @@ static void LoadIniSettingsFromMemory(const char* buf_readonly)
|
||||
|
||||
if (line[0] == '[' && line_end > line && line_end[-1] == ']')
|
||||
{
|
||||
// Close last entry
|
||||
if (entry_data && entry_handler && entry_handler->ReadCloseFn)
|
||||
entry_handler->ReadCloseFn(&g, entry_handler, entry_data);
|
||||
|
||||
// Parse "[Type][Name]". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code.
|
||||
line_end[-1] = 0;
|
||||
const char* name_end = line_end - 1;
|
||||
@ -3757,6 +3761,11 @@ static void LoadIniSettingsFromMemory(const char* buf_readonly)
|
||||
entry_handler->ReadLineFn(&g, entry_handler, entry_data, line);
|
||||
}
|
||||
}
|
||||
|
||||
// Close last entry
|
||||
if (entry_data && entry_handler && entry_handler->ReadCloseFn)
|
||||
entry_handler->ReadCloseFn(&g, entry_handler, entry_data);
|
||||
|
||||
ImGui::MemFree(buf);
|
||||
g.SettingsLoaded = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user