Merge pull request #4932 from larsbrubaker/master

Fixing crash bug
This commit is contained in:
Lars Brubaker 2020-12-10 11:59:11 -08:00 committed by GitHub
commit c0374c92e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 35 deletions

View file

@ -119,8 +119,11 @@ namespace MatterHackers.MatterControl
}
if (!string.IsNullOrEmpty(line))
{
lock (locker)
{
visibleLines.Add(line);
}
return true;
}
@ -141,8 +144,11 @@ namespace MatterHackers.MatterControl
}
public void RebuildFilteredList()
{
lock (locker)
{
visibleLines.Clear();
}
foreach (var lineData in terminalLog.AllTerminalLines())
{
ConditionalyAddToVisible(lineData);
@ -170,8 +176,6 @@ namespace MatterHackers.MatterControl
int numLinesToDraw = NumVisibleLines;
double y = LocalBounds.Bottom + typeFacePrinter.TypeFaceStyle.EmSizeInPixels * numLinesToDraw;
lock (visibleLines)
{
lock (locker)
{
int startLineIndex = visibleLines.Count - numLinesToDraw;
@ -210,7 +214,6 @@ namespace MatterHackers.MatterControl
}
}
}
}
base.OnDraw(graphics2D);
}
@ -218,7 +221,8 @@ namespace MatterHackers.MatterControl
public override void OnMouseWheel(MouseEventArgs mouseEvent)
{
base.OnMouseWheel(mouseEvent);
double scrollDelta = mouseEvent.WheelDelta / (visibleLines.Count * 60.0);
var count = visibleLines.Count;
double scrollDelta = mouseEvent.WheelDelta / (count * 60.0);
if (scrollDelta < 0) // Rounding seems to favor scrolling up, compensating scroll down to feel as smooth
{
@ -226,7 +230,7 @@ namespace MatterHackers.MatterControl
}
else if (Position0To1 == 0) // If we scroll up at the bottom get pop out from the "on screen" chunk
{
scrollDelta = NumVisibleLines / (double)visibleLines.Count;
scrollDelta = NumVisibleLines / (double)count;
}
double newPos = Position0To1 + scrollDelta;

@ -1 +1 @@
Subproject commit 7cb01f7eda7ceba8f5f31134173e893fc9f42ec7
Subproject commit de9c91f7986348b0b891c6614bf7af279e540cbc