Dear all,


I am rather new to Qt and I am working on an application in which I have several ui-files which contain QSpinboxes. Those ui-files were generated while still using Qt 4.8.4-1. Now, I am using 5.4.1 (with Visual Studio 2012 and CMake) and I have observed the following strange behaviour which was not there while still working with Qt 4.8.4-1:
When running the following code in DEBUG mode, then I get a runtime error "... has triggered a breakpoint". It is triggered after leaving the main method. There is no runtime error when running it in RELEASE.


Qt Code:
  1. #include <QApplication>
  2. #include <QWidget>
  3. #include <QSpinBox>
  4. #include <qnamespace.h>
  5. #include <QFlags>
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9. int i=777; //some random value
  10.  
  11. QApplication app(argc, argv);
  12.  
  13.  
  14. QSpinBox *sbxDuration = new QSpinBox();
  15.  
  16. //Call QSpinBox members
  17. //sbxDuration->setMinimum(1); // causes runtime error "... has triggered a breakpoint"
  18. sbxDuration->setMaximum(2); // does not trigger the runtime error
  19. //sbxDuration->setValue(1); // causes runtime error "... has triggered a breakpoint"
  20. //sbxDuration->setSingleStep(0); // causes runtime error "... has triggered a breakpoint"
  21.  
  22.  
  23. //Call QAbstractSpinBox members (none of these calls cause the runtime error)
  24. sbxDuration->setWrapping(true);
  25. sbxDuration->setFrame(true);
  26. QFlags<Qt::AlignmentFlag> flg;
  27. sbxDuration->setAlignment(flg);
  28. sbxDuration->setReadOnly(true);
  29. sbxDuration->setButtonSymbols(QAbstractSpinBox::NoButtons);
  30. sbxDuration->setAccelerated(false);
  31. sbxDuration->setCorrectionMode(QAbstractSpinBox::CorrectToPreviousValue);
  32.  
  33.  
  34. delete sbxDuration;
  35.  
  36. return i;
  37.  
  38. }
  39. // this results in
  40. // "... has exited with code 0 (0x0)." if runtime error occurs
  41. // "has exited with code 777 (0x309)." if no runtime error
To copy to clipboard, switch view to plain text mode 

I added a new system variable called “_NO_DEBUG_HEAP” with a value of “1” to Control Panel->System Properties->Advanced System Settings->Environment Variables->System Variables (http://stackoverflow.com/questions/6...-no-debug-heap). However, that did not help.
My concern is that even if in my minimal example it seems to be only a problem in DEBUG mode, it will be a problem in the "real" application that I am working on.

Does anybody have an idea how to locate the error?!?

Thanks in advence!