From fdddd749f3b6e78214e8cbf9c5b3e9413a7014cd Mon Sep 17 00:00:00 2001
From: "Marcus D. Hanwell" <marcus.hanwell@kitware.com>
Date: Mon, 23 Jun 2014 14:05:22 -0400
Subject: [PATCH] Avoid early termination when collecting actors

This method returns NULL when there are no more objects, but it was
also resulting in NULL if the safe down cast failed. This could lead
to early termination when there is a mixture of different actors and
the context is not the first.

Change-Id: Ia1a13e0be1c89d41fb767c0c99aa064d977f9231
---
 IO/Export/vtkGL2PSExporter.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/IO/Export/vtkGL2PSExporter.cxx b/IO/Export/vtkGL2PSExporter.cxx
index 2de4d1b486d..da18cd948d1 100644
--- a/IO/Export/vtkGL2PSExporter.cxx
+++ b/IO/Export/vtkGL2PSExporter.cxx
@@ -599,10 +599,10 @@ void vtkGL2PSExporter::GetVisibleContextActors(vtkPropCollection *result,
   for (renCol->InitTraversal(); (ren = renCol->GetNextItem());)
     {
     vtkCollection *pCol = ren->GetViewProps();
-    vtkContextActor *act;
-    for (pCol->InitTraversal();
-         (act = vtkContextActor::SafeDownCast(pCol->GetNextItemAsObject()));)
+    vtkObject *object;
+    for (pCol->InitTraversal(); (object = pCol->GetNextItemAsObject());)
       {
+      vtkContextActor *act = vtkContextActor::SafeDownCast(object);
       if (!act || !act->GetVisibility())
         {
         continue;
-- 
GitLab