[vtkusers] Why is QVTKGraphicsItem not in Mainthread?

Zweistein Matthiasth at gmx.de
Wed Aug 21 09:19:12 EDT 2013


Hello,

I came up with this minimal code:

#include "QVTKGraphicsItem.h"
#include <QMainWindow>
#include <QApplication>
#include <QThread>
#include <iostream>

int main(int argc, char **argv)
{ 
	QApplication a(argc, argv);
    QMainWindow w;
		
	QGLContext gc( QGLFormat::defaultFormat());
	QVTKGraphicsItem gi(&gc);		

	std::cout << QThread::currentThread() << "\n" << w.thread() << "\n" <<
gi.thread() << "\n\n";

    w.show();
    return a.exec();
}

The output is: 
000000000233D7D0
000000000233D7D0
000000000216CAF0

How can it be, that the QVTKGraphicsItem is in another Thread?
Is that right?
Later on, in my non minimal code, I get an error, because I send an event to
an object of another thread (ony in debug):

ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to
objects owned by a different thread. Current thread 23dd8b0. Receiver '' (of
type 'QVTKGraphicsItem') was created in thread 22e5e80", file
kernel\qcoreapplication.cpp, line 535

Does it have to do with some Multithreaded DLL stuff?
I think all objects should belong to the Mainthread.

It worked fine before, but now I upgraded my system 
from QT 4.8.3 to QT 4.8.5
from VTK 5.10 to VTK 6.0 (using system HDF 1.8.11 compiled threadsafe)



--
View this message in context: http://vtk.1045678.n5.nabble.com/Why-is-QVTKGraphicsItem-not-in-Mainthread-tp5722937.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list