Hi,

Thanks for the replies and suggestions.

I think I might not have explained the issue as well as I thought, so I'll try 
again.

QThread::currentThread does return a value with static type QThread*. However, 
it might not point to a QThread instance, but an instance of a subclass of 
QThread.

The problem is that OpenThreads assumes that the return value can be cast to a 
pointer to a specific subclass of QThread that OpenThreads defines, 
QtThreadPrivateData, like this:


Code:
QtThreadPrivateData* pd = 
static_cast<QtThreadPrivateData*>(QThread::currentThread());




This is a problem because if the current thread is a different subclass of 
QThread, this cast is invalid so when the new pointer (pd) is used, it causes a 
seg fault or random behavior.

We have observed in our application that this does in fact sometimes occur. 
Specifically, QThread::currentThread can return a QAdoptedThread*, which is 
legal since QAdoptedThread is a subclass of QThread.

I hope this clarifies things.

Thank you!

Cheers,
Chris

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50392#50392





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to