Hi folks
I came across the warning in the title (using QT unser Linux/X11 btw) but without any crash. I understand why and how this happens and read some posts about it (eg http://lists.trolltech.com/qt-intere.../msg00534.html).
I've changed some code and now the message disappeared but I really want to understand if I did the right thing.
This is the scenario when the warning occured:
UI Main Thread
Create the SubThread
SubThread
- created a Hash
- created a QGraphicsView (widget), graphicScene. pixmapitem and setup everything
- stored all pointers/object inside an object and pushed it inside the hash
- called setPixmap
- got warning about not using Pixmap outside the UI thread
This Subthread can create several Widgets - thats the reason why I need the hash
New scenario without warning
UI Main Thread
Create the hash
Create the SubThread and pass the Hash
SubThread
- created a QGraphicsView (widget), graphicScene. pixmapitem and setup everything
- stored all pointers/object inside an object and pushed it inside the hash
- called setPixmap
- NO MORE WARNING
I'm not sure how the pixmap thing and UI painter work. As far as I understand the painter subsystem is not threadsafe and it COULD cause problems when using Pixmap outside the main thread.
But why did the warning disappear when I create the (empty) hash in the main thread? Is this ok now? Or did the warning just disappear because I applied some dirty "trick" and QT can't see the problem anymore. A really "safe" solution would be using signals and slots beween UI and Sub Thread and use setPixmap in the UI thread, right?
BR
J
Bookmarks