Results 1 to 2 of 2

Thread: setPixmap crash (in a thread)

  1. #1
    Join Date
    Feb 2011
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default setPixmap crash (in a thread)

    Hi,

    My QT application uses QLabel->setPixmap() while setting the pixmaps at runtime.

    The pixmap is created on Heap (pixmap = new QPixmap(w,h)), & I use this pixmap to paint multiple QLabels at runtime (this pixmap is just a temporary pixmap to maintain my view).

    For example: when I move the scroller in a window containing my labels I am setting pixmaps or filling all my labels with this pixmap. The initial load of application is fine and it fill all the labels with same pixmap successfully (this code is in main application thread).

    But it just works well for few scroll moves [my thread with
    code qLabel->setPixmap(*pixmap) is already started here ]..till the time it throws the memory exception.

    Any ideas?

    Using:-
    Qt : 4.6.3
    Windows : 7

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setPixmap crash (in a thread)

    As general rule:
    You CANNOT interact with GUI elements from other thread than Main.

    Please Post some piece of code.
    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. thread GUI access crash
    By liqxpil in forum Qt Programming
    Replies: 3
    Last Post: 14th December 2010, 15:47
  2. Qt x11 GUI crash if multi-thread
    By wesley in forum Qt Programming
    Replies: 2
    Last Post: 21st January 2010, 09:11
  3. [PyQt4] Crash when writing to QTextEdit in a thread
    By robtheg in forum Qt Programming
    Replies: 0
    Last Post: 13th May 2009, 02:50
  4. setPixmap cause assertion?
    By Equilibrium in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2007, 00:34
  5. setPixmap
    By mgurbuz in forum Qt Programming
    Replies: 9
    Last Post: 13th July 2007, 13:37

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.