Results 1 to 4 of 4

Thread: QPixmap Crash - "...terminate it in an unusual way" (QT4.4)

  1. #1

    Default QPixmap Crash - "...terminate it in an unusual way" (QT4.4)

    I have done the following:

    Created a new empty QT project.
    Added a source file.


    Qt Code:
    1. #include <QPixmap>
    2.  
    3. int main(int argC,char** argV)
    4. {
    5. QPixmap("D:\new.png");
    6. }
    To copy to clipboard, switch view to plain text mode 

    This results in:

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.
    I am hoping someone can help me figure out how to resolve this issue. I have had it on a much larger scale and been able to work out that the error occurs with even the smallest of scales, as seen above. What would cause such a crash when using QPixmap?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPixmap Crash - "...terminate it in an unusual way" (QT4.4)

    Hi,

    you can use a QPixmap only inside the GUI thread thus you have to initialize QApplication first. Or use QImage instead, which don't need a GUI thread.

  3. #3

    Default Re: QPixmap Crash - "...terminate it in an unusual way" (QT4.4)

    Perfect, thank you.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPixmap Crash - "...terminate it in an unusual way" (QT4.4)

    Once you have a QApplication instance you need to either double the backslash in the path to your file, i.e. "D:\\new.png", or use forward slashes and let Qt work it out for you.

Similar Threads

  1. Replies: 0
    Last Post: 21st September 2011, 18:59
  2. Replies: 2
    Last Post: 13th January 2011, 10:50
  3. QProgressBar "crash" - doesn't work properly
    By metRo_ in forum Qt Programming
    Replies: 6
    Last Post: 23rd October 2010, 13:56
  4. QPixmap: X11 "memory leak" due to shared pixmap data?
    By chezifresh in forum Qt Programming
    Replies: 0
    Last Post: 21st April 2009, 19:53
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.