Skip to content

Commit

Permalink
Limit log memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ngld committed Dec 8, 2021
1 parent ffaa2a8 commit 3285a09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions OverlayPlugin.Core/Controls/ControlPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ private void AddLogEntry(LogEntry entry)
// Remove the error message about the log not being connected since it is now.
logConnected = true;
logBox.Text = "";
} else if (logBox.TextLength > 200 * 1024) {
logBox.Text = "============ LOG TRUNCATED ==============\nThe log was truncated to reduce memory usage.\n=========================================\n" + msg;
return;
}

if (checkBoxFollowLog.Checked)
Expand Down
3 changes: 2 additions & 1 deletion OverlayPlugin.Core/Controls/NewOverlayDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void buttonOK_Click(object sender, EventArgs e)

// Reconstruct the overlay to reset the preview state.
SelectedOverlay = new Overlays.MiniParseOverlay(config, name, container);
if (config.Url == "")
if (config.Url == "" || config.Url.Contains("loading.html"))
{
// If the preview didn't load, we try again here to avoid ending up with an empty overlay.
#if DEBUG
Expand Down Expand Up @@ -182,6 +182,7 @@ private void buttonOK_Click(object sender, EventArgs e)
private void cbPreset_SelectedIndexChanged(object sender, EventArgs e)
{
var preset = (IOverlayPreset)cbPreset.SelectedItem;
if (preset == null) return;

if (preset.Url == "special:custom")
{
Expand Down

0 comments on commit 3285a09

Please sign in to comment.