[vtkusers] Size of labels in vtkScalarBarActor
Cory Quammen
cory.quammen at kitware.com
Wed Nov 29 11:08:43 EST 2017
On Wed, Nov 29, 2017 at 10:38 AM, Miguel <m.nunes at fratoria.com> wrote:
> Hi Cory,
> thank you for your quick reply.
> Unfortunately I am not able to provide this, as vkt is embedded in a complex
> windows system.
Barring even the last few calls of a stack trace, it would be helpful
if you could distill the scalar bar code down to a minimal compilable
program (and provide a CMakeLists.txt file) so I can debug locally.
> However, I edited the file vtkContext2DScalarBarActor.cxx to be able to
> print messages.
> I have found out the crash come from the function /int
> vtkContext2DScalarBarActor::RenderOverlay(vtkViewport* viewport)/
> when /returnValue = this->ActorDelegate->RenderOverlay(viewport);/ is
> called.
>
> I the constructor I see
>
> / this->ActorDelegate = vtkContextActor::New();
> (...)
> vtkContextScene* localScene = vtkContextScene::New();
> this->ActorDelegate->SetScene(localScene);
> localScene->AddItem(this->ScalarBarItem);
> localScene->Delete();
>
> this->CurrentViewport = NULL;
>
> this->Axis = vtkAxis::New();
> this->Axis->SetScene(localScene);/
>
>
> Why is the localScene deleted? Do I have a old version of the code?
That's a standard VTK-ism. Most VTK objects are reference counted.
When the reference count reaches zero, the object is actually deleted.
Here, ::New() increments the reference count once, SetScence()
increments it again (the ActorDelegate adds a reference to
localScene), so now you have two references. Calling Delete() just
decrements the reference count by 1 because the local scope is done
with the object - it won't actually be deleted until the ActorDelegate
and anything else that references decrements the reference count down
to zero. I don't suspect that is where the problem lies.
Cory
> I also printed the viewport size and the values are correct.
>
> I hope this helps.
>
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
More information about the vtkusers
mailing list