My program crashes when I try to load an image from my computer into a QImage. I made sure that the path to the file is correct and tried to make a QImage pointer, but it still results in an error. This was originally part of a larger program, but even in this simple recreation, it doesn't work.

Here is my code in main.cpp:

Qt Code:
  1. #include "mainwindow.h"
  2.  
  3. #include <QApplication>
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication a(argc, argv);
  8. MainWindow w;
  9. QImage test;
  10. test.load("C:/IMAGES/IMAGE.png"); // crashes program
  11. w.show();
  12. return a.exec();
  13. }
To copy to clipboard, switch view to plain text mode 

Here is the error received when I used the debugger:

qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
HEAP[sdf.exe]:
Invalid address specified to RtlFreeHeap( 00000000000D0000, 0000000000DF7240 )

There are also no changes in mainwindow.cpp and the header file, but I added "CONFIG += console" to the .pro file.