Skip to content

Commit

Permalink
BUG: Fix markups handle scale not updating
Browse files Browse the repository at this point in the history
Addresses issue introduced in 580e187 which caused markups handle scale to not update.
The original fix was meant to prevent a crash when starting VR with Markups in the scene, however it disabled scale update in all situations.
Fixed by checking GetNeverRendered() instead of GetGenericContext(), before calling GetScreenSize(). Once the window has been rendered at least once, it is safe to call GetScreenSize().
  • Loading branch information
Sunderlandkyl authored and jcfr committed Apr 4, 2024
1 parent fb0ab78 commit 4bda6b1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,6 @@ double vtkSlicerMarkupsWidgetRepresentation3D::GetViewScaleFactorAtPosition(doub
return viewScaleFactorMmPerPixel;
}


//----------------------------------------------------------------------
void vtkSlicerMarkupsWidgetRepresentation3D::UpdateViewScaleFactor()
{
Expand All @@ -1206,9 +1205,10 @@ void vtkSlicerMarkupsWidgetRepresentation3D::UpdateViewScaleFactor()
{
return;
}
if (!this->Renderer->GetRenderWindow()->GetGenericContext())

if (this->Renderer->GetRenderWindow()->GetNeverRendered())
{
// Calling GetScreenSize() without a context set will cause a crash.
// In VR, calling GetScreenSize() without rendering can cause a crash.
return;
}

Expand Down

0 comments on commit 4bda6b1

Please sign in to comment.