[vtkusers] VTK 6.3/OGL2/Qt5.3.2 : QVTKWidget regression, crash after "reparenting" a widget on OSX

Simon ESNEAULT simon.esneault at gmail.com
Wed Nov 18 08:55:39 EST 2015


Hello,

I've created a bug in Mantis for this
http://www.vtk.org/Bug/view.php?id=15840

Looking at the code in QVTKWidget.cxx, here is the part that may be causing
the problem, because it handles the reparenting part...


*/*******************************************************************************/*
*if(e->type() == QEvent::ParentAboutToChange)*
*    {*
*    this->markCachedImageAsDirty();*
*    if (this->mRenWin)*
*      {*
*      // Finalize the window to remove graphics resources associated with*
*      // this window*
*      if(this->mRenWin->GetMapped())*
*        {*
*        this->mRenWin->Finalize();*
*        }*
*      }*
*    }*
*  else if(e->type() == QEvent::ParentChange)*
*    {*
*    if(this->mRenWin)*
*      {*
*      x11_setup_window();*
*      // connect to new window*
*      this->mRenWin->SetWindowId( reinterpret_cast<void*>(this->winId()));*

*      // start up the window to create graphics resources for this window*
*      if(isVisible())*
*        {*
*        this->mRenWin->Start();*
*        }*
*      }*
*    }*
*/*******************************************************************************/*

Were there any significant changes in the methods GetMapped() / Finalize()
/ Start() of vtkRenderWindow (or children implementation) during the
development of the new rendering backend that may lead to such a crash :


*/*******************************************************************************/*
*ERROR: In
/Users/th-dev/EndoSize_OGL2/cmake-externals/VTK/src/Rendering/OpenGL2/vtkShaderProgram.cxx,
line 354*
*vtkShaderProgram (0x6000001809c0): 1: #version 120*
*2: #define highp*
*3: #define mediump*
*4: #define lowp*
*5: *
*6:
/*=========================================================================*
*7: *
*8:   Program:   Visualization Toolkit*
*9:   Module:    vtkPolyDataVS.glsl*
*10: *
*11:   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen*
*12:   All rights reserved.*
*13:   See Copyright.txt or http://www.kitware.com/Copyright.htm
<http://www.kitware.com/Copyright.htm> for details.*
*14: *
*15:      This software is distributed WITHOUT ANY WARRANTY; without even*
*16:      the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR*
*17:      PURPOSE.  See the above copyright notice for more information.*
*18: *
*19:
=========================================================================*/*
*20: *
*21: attribute vec4 vertexMC;*
*22: *
*23: // frag position in VC*
*24: varying vec4 vertexVCVSOutput;*
*25: *
*26: // optional normal declaration*
*27: attribute vec3 normalMC;*
*28: uniform mat3 normalMatrix;*
*29: varying vec3 normalVCVSOutput;*
*30: *
*31: // extra lighting parameters*
*32: //VTK::Light::Dec*
*33: *
*34: // Texture coordinates*
*35: //VTK::TCoord::Dec*
*36: *
*37: // material property values*
*38: //VTK::Color::Dec*
*39: *
*40: // clipping plane vars*
*41: //VTK::Clip::Dec*
*42: *
*43: // camera and actor matrix values*
*44: uniform mat4 MCDCMatrix;*
*45: uniform mat4 MCVCMatrix;*
*46: *
*47: // Apple Bug*
*48: //VTK::PrimID::Dec*
*49: *
*50: void main()*
*51: {*
*52:   //VTK::Color::Impl*
*53: *
*54:   normalVCVSOutput = normalMatrix * normalMC;*
*55: *
*56:   //VTK::TCoord::Impl*
*57: *
*58:   //VTK::Clip::Impl*
*59: *
*60:   //VTK::PrimID::Impl*
*61: *
*62:   vertexVCVSOutput = MCVCMatrix * vertexMC;*
*63:   gl_Position = MCDCMatrix * vertexMC;*
*64: *
*65: *
*66:   //VTK::Light::Impl*
*67: }*
*68: *


*ERROR: In
/Users/th-dev/EndoSize_OGL2/cmake-externals/VTK/src/Rendering/OpenGL2/vtkShaderProgram.cxx,
line 355*
*vtkShaderProgram (0x6000001809c0): ERROR: 0:1: '' :  version '120' is not
supported*
*ERROR: 0:2: '' :  #version required and missing.*
*ERROR: 0:21: 'attribute' : syntax error: syntax error*


*(lldb) bt*
** thread #1: tid = 0x600e30, 0x0000000100609f1f
VtkReparentingProblem`vtkShaderProgram::FindUniform(char const*) + 31,
queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x60)*
*  * frame #0: 0x0000000100609f1f
VtkReparentingProblem`vtkShaderProgram::FindUniform(char const*) + 31*
*    frame #1: 0x00000001006074ab
VtkReparentingProblem`vtkShaderProgram::SetUniformi(char const*, int) + 27*
*    frame #2: 0x00000001005b8c28
VtkReparentingProblem`vtkOpenGLPolyDataMapper::SetMapperShaderParameters(vtkOpenGLHelper&,
vtkRenderer*, vtkActor*) + 72*
*    frame #3: 0x00000001005b8b1b
VtkReparentingProblem`vtkOpenGLPolyDataMapper::UpdateShaders(vtkOpenGLHelper&,
vtkRenderer*, vtkActor*) + 1211*
*    frame #4: 0x00000001005bb782
VtkReparentingProblem`vtkOpenGLPolyDataMapper::RenderPieceDraw(vtkRenderer*,
vtkActor*) + 818*
*    frame #5: 0x00000001005bbbe3
VtkReparentingProblem`vtkOpenGLPolyDataMapper::RenderPiece(vtkRenderer*,
vtkActor*) + 195*
*    frame #6: 0x00000001004ba1fe
VtkReparentingProblem`vtkPolyDataMapper::Render(vtkRenderer*, vtkActor*) +
174*
*    frame #7: 0x0000000100561be0
VtkReparentingProblem`vtkOpenGLActor::Render(vtkRenderer*, vtkMapper*) +
144*
*    frame #8: 0x00000001004667c3
VtkReparentingProblem`vtkActor::RenderOpaqueGeometry(vtkViewport*) + 435*
*    frame #9: 0x00000001005caa87
VtkReparentingProblem`vtkOpenGLRenderer::UpdateGeometry() + 263*
*    frame #10: 0x00000001005ca945
VtkReparentingProblem`vtkOpenGLRenderer::DeviceRender() + 181*
*    frame #11: 0x00000001004cb96c
VtkReparentingProblem`vtkRenderer::Render() + 604*
*    frame #12: 0x00000001004d08cc
VtkReparentingProblem`vtkRendererCollection::Render() + 92*
*    frame #13: 0x00000001004c5d1a
VtkReparentingProblem`vtkRenderWindow::DoStereoRender() + 138*
*    frame #14: 0x00000001004c5098
VtkReparentingProblem`vtkRenderWindow::Render() + 328*
*    frame #15: 0x00000001005c7816
VtkReparentingProblem`vtkOpenGLRenderWindow::Render() + 22*
*    frame #16: 0x00000001004c8f17
VtkReparentingProblem`vtkRenderWindowInteractor::Render() + 39*
*    frame #17: 0x00000001006831dd
VtkReparentingProblem`QVTKWidget::paintEvent(QPaintEvent*) + 109*
*    frame #18: 0x0000000100bb73d6 QtWidgets`QWidget::event(QEvent*) + 1958*
*    frame #19: 0x0000000100683079
VtkReparentingProblem`QVTKWidget::event(QEvent*) + 281*
*    frame #20: 0x0000000100b7effc
QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 300*
*    frame #21: 0x0000000100b81abb QtWidgets`QApplication::notify(QObject*,
QEvent*) + 6187*
*    frame #22: 0x0000000101902932
QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 114*
*    frame #23: 0x0000000100bb2035
QtWidgets`QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint
const&, int, QPainter*, QWidgetBackingStore*) + 2997*
*    frame #24: 0x0000000100b8aed0
QtWidgets`QWidgetPrivate::repaint_sys(QRegion const&) + 400*
*    frame #25: 0x0000000100bd4987 QtWidgets`QWidgetWindow::event(QEvent*)
+ 423*
*    frame #26: 0x0000000100b7effc
QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 300*
*    frame #27: 0x0000000100b81abb QtWidgets`QApplication::notify(QObject*,
QEvent*) + 6187*
*    frame #28: 0x0000000101902932
QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 114*
*    frame #29: 0x00000001011c4d7a
QtGui`QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*)
+ 314*
*    frame #30: 0x00000001011c08a7
QtGui`QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
+ 951*
*    frame #31: 0x00000001011af1cb
QtGui`QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)
+ 315*
*    frame #32: 0x0000000104a39f0d
libqcocoa.dylib`QCocoaEventDispatcherPrivate::processPostedEvents() + 317*
*    frame #33: 0x0000000104a3a8a8
libqcocoa.dylib`QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*)
+ 40*
*    frame #34: 0x00007fff8f9e3a01
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ +
17*
*    frame #35: 0x00007fff8f9d5b8d CoreFoundation`__CFRunLoopDoSources0 +
269*
*    frame #36: 0x00007fff8f9d51bf CoreFoundation`__CFRunLoopRun + 927*
*    frame #37: 0x00007fff8f9d4bd8 CoreFoundation`CFRunLoopRunSpecific +
296*
*    frame #38: 0x00007fff8b65f56f HIToolbox`RunCurrentEventLoopInMode +
235*
*    frame #39: 0x00007fff8b65f2ea HIToolbox`ReceiveNextEventCommon + 431*
*    frame #40: 0x00007fff8b65f12b
HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71*
*    frame #41: 0x00007fff894cf8ab AppKit`_DPSNextEvent + 978*
*    frame #42: 0x00007fff894cee58 AppKit`-[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 346*
*    frame #43: 0x00007fff894c4af3 AppKit`-[NSApplication run] + 594*
*    frame #44: 0x0000000104a395e4
libqcocoa.dylib`QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
+ 2420*
*    frame #45: 0x00000001018ff9ad
QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 381*
*    frame #46: 0x0000000101902ee7 QtCore`QCoreApplication::exec() + 359*
*    frame #47: 0x0000000100005dab VtkReparentingProblem`main + 59*
*    frame #48: 0x0000000100005d64 VtkReparentingProblem`start + 52*

*/*******************************************************************************/*

Any hints ?

Regards,
Simon

2015-11-17 9:27 GMT+01:00 Simon ESNEAULT <simon.esneault at gmail.com>:

> Hello,
>
> After the switch to the new rendering backend, we have a crash on our
> program after reparenting a QVTKWidget on OSX. The crash is in the
> method vtkShaderProgram::FindUniform() but we suspect it is about the
> OpenGL context not being ready on time for the next paintEvent with the new
> parent.
>
> Attached is a program that reproduce the problem, as well as a complete
> backtrace for this crash. This used to work fine with the previous backend.
>
> Hope this little test case helps
>
> Thanks
> Simon
>
> --
> ------------------------------------------------------------------
> Simon Esneault
> Rennes, France
> ------------------------------------------------------------------
>



-- 
------------------------------------------------------------------
Simon Esneault
Rennes, France
------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151118/d505a489/attachment-0001.html>


More information about the vtkusers mailing list