QVTKOpenGLNativeWidget rise unhandled exception (Qt6Core.dll) in debug mode

Hello,

I have a little problem with VTK and QT.

In my QT ui, i added a QVTKOpenGLNativeWidget.
If i execute the code, which use this widget to plot, in release mode every things is ok and work perfectly but if i execute the code in debug,
i get an unhandled exception (Qt6Core.dll) in my ui_PlotWIdget.h at the line:

qvtkWidget = new QVTKOpenGLNativeWidget(PlotWidget);

thank you in advance!

I have with success using VTK and Qt6 on windows using instead QVTKOpenGLWidget and followed the design pattern from CTK, where I inherit ctkVTKOpenGLNativeWidget. I just cherry-picked the interfacing Qt widgets from CTK. I have not had any success with multi configurations, so I create two solution folders, one for debug and one for release, where I use VTK in debug and release, respectively.

Hello,

Are you in Windows? If so, make sure you’re not mixing debug and release versions of the libraries (e.g. debug versions of VTK DLLs with release versions of Qt DLLs).

If you made sure you’re not mixing them, I suggest you to do this:


qvtkWidget = new QVTKOpenGLNativeWidget();

//
//All QVTKOpenGLNativeWidget setup code going before adding it to Qt.
//
(...)

PlotWidget->layout()->addWidget( qvtkWidget );

take care,

PC

thank you. I rebuilt and install vtk and now i dont have anymore problems

But i have a question: why the error was raise by qt6core and not qt6cored?

1 Like

You must somehow have linked to the release version - otherwise this makes no sense.

First, you need to double check you’re not loading debug and release versions of ALL the dependencies when running/debuging/profiling your application. This particularly holds true with VTK, Qt and Qwt libraries, for example, as they do “risky” operations (e.g. graphics rendering and exchange signals/slots), but this may also be the case for other libraries as well.