#7024 Fix crash when closing comparison view on linux.

The state of caf::Viewer::isComparisonViewActive() and Rim3dView::activeComparisonView()
can be out-of-sync until all events have been processed by the Qt event loop.
The caf::Viewer state is updated as part of an scheduled display update, but the
update to Rim3dView is a direct call.

Fix crash by checking for nullptr from Rim3dView::activeComparisonView().

Closes #7024.
This commit is contained in:
Kristian Bendiksen
2020-11-20 13:05:31 +01:00
committed by Magne Sjaastad
parent 68153c836a
commit a4d60a630c

View File

@@ -429,6 +429,8 @@ void RiuViewer::paintOverlayItems( QPainter* painter )
if ( this->isComparisonViewActive() )
{
Rim3dView* compView = dynamic_cast<Rim3dView*>( m_rimView.p() )->activeComparisonView();
if ( compView )
{
columnWidth = 200;
// int sliderPos = this->width() * this->comparisonViewVisibleNormalizedRect().min().x();
@@ -448,7 +450,8 @@ void RiuViewer::paintOverlayItems( QPainter* painter )
}
{
m_shortInfoLabelCompView->setText( "<center>" + compView->ownerCase()->caseUserDescription() + "</center>" );
m_shortInfoLabelCompView->setText( "<center>" + compView->ownerCase()->caseUserDescription() +
"</center>" );
QPoint topLeft = QPoint( compViewItemsXPos, yPos );
m_shortInfoLabelCompView->resize( columnWidth, m_shortInfoLabelCompView->sizeHint().height() );
m_shortInfoLabelCompView->render( painter, topLeft );
@@ -484,6 +487,7 @@ void RiuViewer::paintOverlayItems( QPainter* painter )
m_infoPickAreaCompView.setHeight( pickAreaHeight );
m_infoPickAreaCompView.setTop( startYPos );
}
}
if ( showAnimBar && m_showAnimProgress )
{