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.
#include <QApplication>
#include <QWidget>
#include <QSpinBox>
#include <qnamespace.h>
#include <QFlags>
int main(int argc, char *argv[])
{
int i=777; //some random value
//Call QSpinBox members
//sbxDuration->setMinimum(1); // causes runtime error "... has triggered a breakpoint"
sbxDuration->setMaximum(2); // does not trigger the runtime error
//sbxDuration->setValue(1); // causes runtime error "... has triggered a breakpoint"
//sbxDuration->setSingleStep(0); // causes runtime error "... has triggered a breakpoint"
//Call QAbstractSpinBox members (none of these calls cause the runtime error)
sbxDuration->setWrapping(true);
sbxDuration->setFrame(true);
QFlags<Qt::AlignmentFlag> flg;
sbxDuration->setAlignment(flg);
sbxDuration->setReadOnly(true);
sbxDuration->setAccelerated(false);
delete sbxDuration;
return i;
}
// this results in
// "... has exited with code 0 (0x0)." if runtime error occurs
// "has exited with code 777 (0x309)." if no runtime error
#include <QApplication>
#include <QWidget>
#include <QSpinBox>
#include <qnamespace.h>
#include <QFlags>
int main(int argc, char *argv[])
{
int i=777; //some random value
QApplication app(argc, argv);
QSpinBox *sbxDuration = new QSpinBox();
//Call QSpinBox members
//sbxDuration->setMinimum(1); // causes runtime error "... has triggered a breakpoint"
sbxDuration->setMaximum(2); // does not trigger the runtime error
//sbxDuration->setValue(1); // causes runtime error "... has triggered a breakpoint"
//sbxDuration->setSingleStep(0); // causes runtime error "... has triggered a breakpoint"
//Call QAbstractSpinBox members (none of these calls cause the runtime error)
sbxDuration->setWrapping(true);
sbxDuration->setFrame(true);
QFlags<Qt::AlignmentFlag> flg;
sbxDuration->setAlignment(flg);
sbxDuration->setReadOnly(true);
sbxDuration->setButtonSymbols(QAbstractSpinBox::NoButtons);
sbxDuration->setAccelerated(false);
sbxDuration->setCorrectionMode(QAbstractSpinBox::CorrectToPreviousValue);
delete sbxDuration;
return i;
}
// this results in
// "... has exited with code 0 (0x0)." if runtime error occurs
// "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!
Bookmarks