Skip to content

Commit

Permalink
fix possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Feb 25, 2024
1 parent 7f99220 commit 4b452da
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions vstgui/lib/ctexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,30 +574,30 @@ void TextEditorView::parentSizeChanged ()
{
if (md.scrollView)
{
auto func = [this] () mutable {
if (!md.scrollView)
auto func = [This = shared (this)] () mutable {
if (!This->isAttached () || !This->md.scrollView)
return;
auto viewSize = getViewSize ();
viewSize.setHeight (md.maxHeight);
viewSize.setWidth (md.maxWidth);
auto containerSize = md.scrollView->calculateOptimalContainerSize ();
auto viewSize = This->getViewSize ();
viewSize.setHeight (This->md.maxHeight);
viewSize.setWidth (This->md.maxWidth);
auto containerSize = This->md.scrollView->calculateOptimalContainerSize ();
if (containerSize.getWidth () > viewSize.getWidth ())
{
if (viewSize.getHeight () > containerSize.getHeight ())
viewSize.setWidth (containerSize.getWidth () -
md.scrollView->getScrollbarWidth ());
This->md.scrollView->getScrollbarWidth ());
else
viewSize.setWidth (containerSize.getWidth ());
}
if (containerSize.getHeight () > viewSize.getHeight ())
{
if (viewSize.getWidth () > containerSize.getWidth ())
viewSize.setHeight (containerSize.getHeight () -
md.scrollView->getScrollbarWidth ());
This->md.scrollView->getScrollbarWidth ());
else
viewSize.setHeight (containerSize.getHeight ());
}
setViewSize (viewSize);
This->setViewSize (viewSize);
};
auto frame = getFrame ();
if (frame && frame->inEventProcessing ())
Expand Down

0 comments on commit 4b452da

Please sign in to comment.