Results 1 to 3 of 3

Thread: QT 4.7.1 Win 7 x64 VS 2010: Debug works, Release crashes

  1. #1
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy QT 4.7.1 Win 7 x64 VS 2010: Debug works, Release crashes

    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

  2. #2
    Join Date
    Apr 2009
    Location
    Italy
    Posts
    70
    Thanks
    23
    Thanked 15 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT 4.7.1 Win 7 x64 VS 2010: Debug works, Release crashes

    There are known problems with Qt and VS 2010 64 bit, see this bug report:
    http://bugreports.qt.nokia.com/browse/QTBUG-11445

    A patch from Microsoft is known to fix the problem above. Maybe you can try it as well.

  3. The following 4 users say thank you to mattc for this useful post:

    Kal (29th December 2010), MrBlueSky (14th April 2011), new_voodoo (28th November 2010), tangens (9th March 2011)

  4. #3
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT 4.7.1 Win 7 x64 VS 2010: Debug works, Release crashes

    Hi and thanks a lot!

    That patch worked!
    I simply rebuild my Qt 4.7.1 package using the x64 VS2010 console and recompiled the application and bingo.

    Thanks

Similar Threads

  1. Program works in Release but not Debug
    By Ferric in forum Newbie
    Replies: 2
    Last Post: 28th January 2010, 02:08
  2. Release ok, debug crashes [compilable code]
    By Raccoon29 in forum Qt Programming
    Replies: 8
    Last Post: 16th December 2009, 16:48
  3. Replies: 3
    Last Post: 29th August 2009, 23:24
  4. Replies: 3
    Last Post: 8th June 2009, 09:07
  5. Replies: 5
    Last Post: 5th October 2008, 06:12

Tags for this Thread

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.