Internals: Removed unnecessary allocation indirection for g.LogClipboard (this only made sense when there was a global context instance)
This commit is contained in:
parent
35e74c72ab
commit
023cc25c7c
13
imgui.cpp
13
imgui.cpp
@ -3669,7 +3669,6 @@ void ImGui::Initialize(ImGuiContext* context)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *context;
|
ImGuiContext& g = *context;
|
||||||
IM_ASSERT(!g.Initialized && !g.SettingsLoaded);
|
IM_ASSERT(!g.Initialized && !g.SettingsLoaded);
|
||||||
g.LogClipboard = IM_NEW(ImGuiTextBuffer)();
|
|
||||||
|
|
||||||
// Add .ini handle for ImGuiWindow type
|
// Add .ini handle for ImGuiWindow type
|
||||||
ImGuiSettingsHandler ini_handler;
|
ImGuiSettingsHandler ini_handler;
|
||||||
@ -3736,9 +3735,7 @@ void ImGui::Shutdown(ImGuiContext* context)
|
|||||||
fclose(g.LogFile);
|
fclose(g.LogFile);
|
||||||
g.LogFile = NULL;
|
g.LogFile = NULL;
|
||||||
}
|
}
|
||||||
if (g.LogClipboard)
|
g.LogClipboard.clear();
|
||||||
IM_DELETE(g.LogClipboard);
|
|
||||||
g.LogClipboard = NULL;
|
|
||||||
|
|
||||||
g.Initialized = false;
|
g.Initialized = false;
|
||||||
}
|
}
|
||||||
@ -4179,7 +4176,7 @@ void ImGui::LogText(const char* fmt, ...)
|
|||||||
if (g.LogFile)
|
if (g.LogFile)
|
||||||
vfprintf(g.LogFile, fmt, args);
|
vfprintf(g.LogFile, fmt, args);
|
||||||
else
|
else
|
||||||
g.LogClipboard->appendfv(fmt, args);
|
g.LogClipboard.appendfv(fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7973,10 +7970,10 @@ void ImGui::LogFinish()
|
|||||||
fclose(g.LogFile);
|
fclose(g.LogFile);
|
||||||
g.LogFile = NULL;
|
g.LogFile = NULL;
|
||||||
}
|
}
|
||||||
if (g.LogClipboard->size() > 1)
|
if (g.LogClipboard.size() > 1)
|
||||||
{
|
{
|
||||||
SetClipboardText(g.LogClipboard->begin());
|
SetClipboardText(g.LogClipboard.begin());
|
||||||
g.LogClipboard->clear();
|
g.LogClipboard.clear();
|
||||||
}
|
}
|
||||||
g.LogEnabled = false;
|
g.LogEnabled = false;
|
||||||
}
|
}
|
||||||
|
@ -683,7 +683,7 @@ struct ImGuiContext
|
|||||||
// Logging
|
// Logging
|
||||||
bool LogEnabled;
|
bool LogEnabled;
|
||||||
FILE* LogFile; // If != NULL log to stdout/ file
|
FILE* LogFile; // If != NULL log to stdout/ file
|
||||||
ImGuiTextBuffer* LogClipboard; // Else log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
ImGuiTextBuffer LogClipboard; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
||||||
int LogStartDepth;
|
int LogStartDepth;
|
||||||
int LogAutoExpandMaxDepth;
|
int LogAutoExpandMaxDepth;
|
||||||
|
|
||||||
@ -783,7 +783,6 @@ struct ImGuiContext
|
|||||||
|
|
||||||
LogEnabled = false;
|
LogEnabled = false;
|
||||||
LogFile = NULL;
|
LogFile = NULL;
|
||||||
LogClipboard = NULL;
|
|
||||||
LogStartDepth = 0;
|
LogStartDepth = 0;
|
||||||
LogAutoExpandMaxDepth = 2;
|
LogAutoExpandMaxDepth = 2;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user