Crash inserting QTreeWidgetItem into a QTreeWidget
-
Hello,
I don't know if anybody can verify and duplicate the problem I'm having. Here's the details :
I rebuild Qt 4.8.2 in 64 Bits using MSVC2010 under Windows 7 Pro 64 Bits. I'm creating a simple GUI Application using QtCreator, adding a QTreeWidget in the main window, and then adding a QTreeWidgetItem from within the constructor.
Here's the constructor code :
@
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);ui->treeWidget->addTopLevelItem( new QTreeWidgetItem() );
}
@Only added the addTopLevelItem line.
If I run the application in debug, everything is fine. But when I try to run it in Release, it crash at startup.
Anybody else having that ?
-
How does it crash, does it show an error message?
Maybe some dependencies (DLLs) are missing in release folder? -
It shows an error dialog from Windows asking to look for solution, close or debug the application. I'm pretty sure it's not a dependency, if I comment out the line where I add the widget it starts fine. Plus only dependencies it has are Qt4Core and Qt4Gui dlls, which are present.
To put in context, I have a bigger program that crashes in release 64 bits only. It works well in debug 32 and 64 bits, as well as release 32 bits. I was able to narrow down the problem to the addTopLevelItem line. The test application containing the line shown in previous post was made to confirm the quickest way to get the problem.
I forgot to add the fact I recompiled Qt libs with wchar_t enabled.
-
Just as a follow-up for those interested, I spent some time debugging QtGui4.dll and found the problem.
The crash happends in QAbstractItemView.cpp in function :
@
QStyleOptionViewItem QAbstractItemView::viewOptions() const
@at line 3576
@
option.rect = QRect();
@I looked in QRect class and found no assignment operator. So I implemented one to check and everything worked fine after. It's a very simple fix.