[vtkusers] Null pointer with Visual Studio 2010

cfd new newcfd at yahoo.com
Fri Jan 8 13:39:00 EST 2016


I compiled vtk 6.3 with VS 2010.I had a few crashes when my GUI Is launched.I added the following code in my application program#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL); 
VTK_MODULE_INIT(vtkRenderingContextOpenGL); 
VTK_MODULE_INIT(vtkInteractionStyle); 

to avoid these crashes.
Then when my code starts from QApplication app(argc, argv); 
MyQTGUI mygui; 
mygui.show(); 
app.exec(); <==crashes from here. 
call stack shows this->Implementation->TextRenderer is NULLin the following code. 
what is the reason?

vtkVector2i vtkTextRendererStringToImage::GetBounds( 
    vtkTextProperty *property, const vtkUnicodeString& string, int dpi) 
{ 
  int tmp[4] = { 0, 0, 0, 0 }; 
  vtkVector2i recti(tmp); 
  if (!property) 
    { 
    return recti; 
    } 

  this->Implementation->TextRenderer->GetBoundingBox(property, string, tmp, 
                                                     dpi); 

  recti.Set(tmp[1] - tmp[0], 
            tmp[3] - tmp[2]); 

  return recti; 
} 

======================call statck output=======================================  vtkRenderingCore-6.3.dll!vtkTextRenderer::GetBoundingBox(vtkTextProperty * tprop, const vtkUnicodeString & str, int * bbox, int dpi, int backend)  Line 158 + 0x5 bytes C++ 
  vtkRenderingFreeType-6.3.dll!vtkTextRendererStringToImage::GetBounds(vtkTextProperty * property, const vtkUnicodeString & string, int dpi)  Line 66 C++ 
  vtkRenderingContextOpenGL-6.3.dll!vtkOpenGLContextDevice2D::ComputeStringBounds(const vtkUnicodeString & string, float * bounds)  Line 947 C++ 
  vtkRenderingContextOpenGL-6.3.dll!vtkOpenGLContextDevice2D::ComputeStringBounds(const vtkStdString & string, float * bounds)  Line 849 + 0x48 bytes C++ 
  vtkRenderingContext2D-6.3.dll!vtkContext2D::ComputeStringBounds(const vtkStdString & string, float * bounds)  Line 646 C++ 
  vtkChartsCore-6.3.dll!vtkAxis::GetBoundingRect(vtkContext2D * painter)  Line 845 C++ 
  vtkChartsCore-6.3.dll!vtkChartXY::UpdateLayout(vtkContext2D * painter)  Line 851 C++ 
  vtkChartsCore-6.3.dll!vtkChartXY::Paint(vtkContext2D * painter)  Line 395 C++ 
  vtkRenderingContext2D-6.3.dll!vtkContextScenePrivate::PaintItems(vtkContext2D * context)  Line 81 C++ 
  vtkRenderingContext2D-6.3.dll!vtkContextScene::Paint(vtkContext2D * painter)  Line 120 C++ 
  vtkRenderingContext2D-6.3.dll!vtkContextActor::RenderOverlay(vtkViewport * viewport)  Line 221 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderer::UpdateGeometry()  Line 585 + 0x41 bytes C++ 
  vtkRenderingOpenGL-6.3.dll!vtkOpenGLRenderer::DeviceRender()  Line 273 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderer::Render()  Line 298 C++ 
  vtkRenderingCore-6.3.dll!vtkRendererCollection::Render()  Line 53 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderWindow::DoStereoRender()  Line 771 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderWindow::DoFDRender()  Line 739 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderWindow::DoAARender()  Line 618 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderWindow::Render()  Line 434 C++ 
  vtkRenderingCore-6.3.dll!vtkRenderWindowInteractor::Render()  Line 175 C++ 
  vtkViewsContext2D-6.3.dll!vtkContextInteractorStyle::RenderNow()  Line 147 C++ 
  vtkViewsContext2D-6.3.dll!vtkContextInteractorStyle::ProcessInteractorEvents(vtkObject * __formal, unsigned long eventId, void * clientdata, vtkObject * __formal)  Line 132 C++ 
  vtkCommonCore-6.3.dll!vtkCallbackCommand::Execute(vtkObject * caller, unsigned long event, void * callData)  Line 43 C++ 
  vtkCommonCore-6.3.dll!vtkSubjectHelper::InvokeEvent(unsigned long event, void * callData, vtkObject * self)  Line 619 C++ 
  vtkCommonCore-6.3.dll!vtkObject::InvokeEvent(unsigned long event, void * callData)  Line 785 + 0x1c bytes C++ 
  vtkGUISupportQt-6.3.dll!QVTKInteractor::TimerEvent(int timerId)  Line 217 C++ 
  vtkGUISupportQt-6.3.dll!QVTKInteractorInternal::TimerEvent(int id)  Line 73 C++ 
  vtkGUISupportQt-6.3.dll!QVTKInteractorInternal::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a)  Line 52 C++ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160108/94ae03b1/attachment.html>


More information about the vtkusers mailing list