Results 1 to 6 of 6

Thread: It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)

  1. #1
    Join Date
    Nov 2009
    Posts
    15

    Default It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)

    Hello,

    Si I'm having this issue where Qt complains about with the following:

    QPixmap: It is not safe to use pixmaps outside the GUI thread

    But I'm doing moveToThread(QApplication::instance()->thread()), and re-checking using the method currentThreadId() whether the move when as expected and it seems to be in the correct thread, and yet it complains.
    Also, the object is already in the GUI thread (if I don't use the moveToThread, the Ids are the same).

    What could be causing this? Is comparing this->thread()->currentThreadId() == QApplication::instance()->thread()->currentThreadId() not the best way of checking this?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)

    Hard to say without seeing the code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2009
    Posts
    15

    Default Re: It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)

    You can see the code I'm talking about in here:

    https://gitweb.torproject.org/chiiph...iewer.cpp#l363

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)

    Where is the pixmap?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2009
    Posts
    15

    Default Re: It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)


  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: It is not safe to use pixmaps outside the GUI thread (but I'm in the GUI thread)

    Hmmm.... I suggest you cut the minimum of your project and paste it here. I really do not feel like jumping around files of your project.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QPixmap: It is not safe to use pixmaps outside the GUI thread
    By bibhukalyana in forum Qt Programming
    Replies: 9
    Last Post: 16th May 2011, 08:30
  2. thread-safe
    By babymonsta in forum Qt Programming
    Replies: 0
    Last Post: 5th May 2010, 11:18
  3. Why is QMutex Thread Safe?
    By Kind Lad in forum Newbie
    Replies: 3
    Last Post: 22nd February 2010, 05:46
  4. Is a QProcess thread safe in Qt4?
    By Jay_D in forum Qt Programming
    Replies: 4
    Last Post: 1st September 2009, 17:38
  5. need to draw on pixmaps outside of the gui thread
    By Serenius in forum Qt Programming
    Replies: 2
    Last Post: 27th January 2009, 17:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.