QMdiaArea::addSubWindow() causes crash only in a released version
QMdiaArea::addSubWindow() causes crash only in a released version. I have installed Qt 4.7.0 on a 64-bit machine. I installed it with Visual Studion 2010 x64 compiler. When I ran mdi example in Qt (in \Qt\4.7.0\examples\mainwindows\mdi), the program crashes with the release version, but not with the开发者_开发技巧 debug version. The function causing the problem is QMdiArea:: addSubWindow(). In the mdi example, when I open a new file in the application, the application crashes. The corresponding code is:
MdiChild *MainWindow::createMdiChild()
{
MdiChild *child = new MdiChild;
mdiArea->addSubWindow(child);
...
When I comment out
mdiArea->addSubWindow(child);
then, the program works fine even with the release version. Of course, the child widget is not a sub window of the main window anymore. With the debug version, the program works fine even without commenting out the line above.
I have reinstalled Qt, but that didn’t solve the problem. I would like to know why this happens and how I can fix this.
Thank you so much,
Daisuke
精彩评论