Hi.

The system is:
QT 4.7.1, Win 7 x64, VS 2010 Prof

I downloaded Qt 4.7.1(everywhere) from Nokia Ftp. Unzipped it and compiled it with x64 VS console.
Compilation worked, so that I recieved a debug and release dll.

My test program is very simple:

Qt Code:
  1. #ifdef _DEBUG
  2. #pragma comment( lib, "QtMaind.lib" )
  3. #pragma comment( lib, "QtGuid4.lib" )
  4. #pragma comment( lib, "QtCored4.lib" )
  5. #else
  6. #pragma comment( lib, "QtMain.lib" )
  7. #pragma comment( lib, "QtCore4.lib" )
  8. #pragma comment( lib, "QtGui4.lib" )
  9. #endif
  10.  
  11. int main(int argc, char** argv)
  12. {
  13.  
  14. QApplication app( argc, argv ) ;
  15.  
  16. QTreeWidget* wg = new QTreeWidget() ;
  17.  
  18. wg->show() ;
  19.  
  20. //QWidget* wg2 = new QWidget() ;
  21. //wg2->show() ;
  22.  
  23. return app.exec();
  24. }
To copy to clipboard, switch view to plain text mode 

If I compile in debug mode, everything workds just fine.
BUT if I compile in release mode, the application crashes at app.exec().
The call stack shows the crash in QtGui4.dll.

If I change the line
Qt Code:
  1. QTreeWidget* wg = new QTreeWidget() ;
  2. wg->show() ;
To copy to clipboard, switch view to plain text mode 
to
Qt Code:
  1. QTreeWidget* wg = new QTreeWidget() ;
  2. //wg->show() ; // comment the show() here
To copy to clipboard, switch view to plain text mode 
the release mode compiled app suddenly works.

If I do this
Qt Code:
  1. QTreeWidget* wg = new QTreeWidget() ;
  2. //wg->show() ;
  3.  
  4. QWidget* wg2 = new QWidget() ;
  5. wg2->show() ;
To copy to clipboard, switch view to plain text mode 
the code also works just fine.

If I do this again:
Qt Code:
  1. QTreeWidget* wg = new QTreeWidget() ;
  2. wg->show() ;
  3.  
  4. QWidget* wg2 = new QWidget() ;
  5. wg2->show() ;
To copy to clipboard, switch view to plain text mode 
The application crashes again.

If I change from release to debug lib for QtGui.lib,
Qt Code:
  1. #ifdef _DEBUG
  2. #pragma comment( lib, "QtMaind.lib" )
  3. #pragma comment( lib, "QtGuid4.lib" )
  4. #pragma comment( lib, "QtCored4.lib" )
  5.  
  6. #else // else use RELEASE
  7.  
  8. #pragma comment( lib, "QtMain.lib" )
  9. #pragma comment( lib, "QtCore4.lib" )
  10. #pragma comment( lib, "QtGuid4.lib" ) // HERE changed to debug lib! But here the release section resides!
  11. #endif
To copy to clipboard, switch view to plain text mode 
everything works again. So there must be some kind of bug in the release build or I simply compiled my x64 qt wrong and the bug must be connected with QTreeWidget!
Because if I simply show the QWidget, the app runs, with QTreeWidget it doesn't run, it crashes as described.

The run-time error is:
Unhandled exception at 0x5cb96e5f in QtReleaseBuildTest.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
Call stack is:
QtGui4.dll!000000005cb96e5f()
[Frames below may be incorrect and/or missing, no symbols loaded for QtGui4.dll]
QtGui4.dll!000000005cb96eee()
QtGui4.dll!000000005cbcfe77()
QtGui4.dll!000000005cbd2b37()
QtGui4.dll!000000005c7aa886()
QtGui4.dll!000000005caaef87()
QtGui4.dll!000000005cb98ed5()
QtCore4.dll!000000005d1a2c43()
QtGui4.dll!000000005c760382()
QtGui4.dll!000000005c7632e6()
QtCore4.dll!000000005d1a2ad2()
QtGui4.dll!000000005c7a8bcd()
QtGui4.dll!000000005c79ecaf()
QtGui4.dll!000000005c79eba2()
QtGui4.dll!000000005c7a8d5c()
QtGui4.dll!000000005c915f36()
QtGui4.dll!000000005c79dd68()
QtGui4.dll!000000005c7aac75()
QtGui4.dll!000000005caaef87()
QtGui4.dll!000000005cb20782()
QtGui4.dll!000000005c760396()
QtGui4.dll!000000005c7632e6()
QtCore4.dll!000000005d1a2ad2()
QtCore4.dll!000000005d1a44ea()
QtCore4.dll!000000005d1c5e0e()
user32.dll!00000000778cc3c1()
user32.dll!00000000778cc60a()
QtCore4.dll!000000005d1c7c7a()
QtGui4.dll!000000005c7c3dc5()
QtCore4.dll!000000005d1a202a()
QtCore4.dll!000000005d1a61c0()
> QtReleaseBuildTest.exe!main(int argc, char * * argv) Line 34 + 0x6 bytes C++
QtReleaseBuildTest.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C
kernel32.dll!00000000777af56d()
ntdll.dll!00000000779e3021()
Has somebody any idea?

Thanks