[vtkusers] QT/VTK application: Access violation on vtkTransform inside a QTimer event

Elvis Chen elvis.chen at gmail.com
Wed Nov 9 10:49:32 EST 2011


hi all,

Thanks for the tip.  It looks if the vtkTransform is indeed there, but the
(internal) inverse transform of the vtkTransform is NOT.  In particular,
through debugging, it is the following line that raised the access
violation error:


//----------------------------------------------------------------------------
// Need to check inverse's MTime if we are an inverse transform
unsigned long vtkAbstractTransform::GetMTime()
{
  unsigned long mtime = this->vtkObject::GetMTime();
  if (this->DependsOnInverse)
    {
    unsigned long inverseMTime = this->MyInverse->GetMTime();
 <========== this line
    if (inverseMTime > mtime)
      {
      return inverseMTime;
      }
    }

  return mtime;
}


Is this a bug in vtkTransform/vtkAbstractTransform, in which the inverse
transform is not being allocated/updated automatically?

I'm using vtk 5.6.1.

any help is very much appreciated,



On Tue, Nov 8, 2011 at 9:49 AM, John Drescher <drescherjm at gmail.com> wrote:

> On Tue, Nov 8, 2011 at 9:39 AM, Elvis Chen <elvis.chen at gmail.com> wrote:
> > hi all,
> > I'm writing an application base on QT/VTK, using 3D positional tracking
> > system.  The pose of an tracked object is returned as a vtkTransform,
> and it
> > is obtained using a QTimer event.  The timing interval is set at 0, thus
> it
> > is updating the vtkTransform continuously (or as fast as the
> > computer/tracking system can).
> > The vtkTransform is defined as an class object and it would be accessed
> by
> > other class members.  However, I noticed that sometimes wI would get an
> > access violation error:
> >
> > First-chance exception at 0x60c48183 (vtkCommon.dll) in my.exe:
> 0xC0000005:
> > Access violation reading location 0xfeeeff36.
> > Unhandled exception at 0x60c48183 (vtkCommon.dll) in my.exe: 0xC0000005:
> > Access violation reading location 0xfeeeff36.
> > The program '[5788] my.exe: Native' has exited with code -1073741819
> > (0xc0000005).
> > and the place where the access violation occurs is in
> > vtkAbstractTransform::GetMTime
> >     unsigned long inverseMTime = this->MyInverse->GetMTime();
> > which is being updated in the QTimer event.
> >
> > What would be proper mechanism to prevent such access violation?
> > any help is very much appreciated,
>
> Looks like you are using a pointer that has had its memory released.
> 0xfeee is the clue.
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111109/0fe46676/attachment.htm>


More information about the vtkusers mailing list