Crash in 'Getting started' tutorial on Fedora 14
-
Hello, I'm just getting started learning Qt and began with the tutorial at: http://doc.qt.nokia.com/4.7/gettingstartedqt.html
Unfortunately less than 10 minutes in, I already find myself googling for fixes for a crash which occurs at the second step of the tutorial, in which a text field and a 'Quit' button are added to a layout. The app runs fine until I try to close it, either with the quit button or just with the normal window close button, and then it crashes as below:
*** glibc detected *** ./qt: double free or corruption (out): 0xbfe52830 ***
======= Backtrace: =========
/lib/libc.so.6[0x88afb6]
/usr/lib/libstdc++.so.6(_ZdlPv+0x22)[0x426afc2]
/usr/lib/libQtGui.so.4(_ZN11QVBoxLayoutD0Ev+0x2b)[0x215703b]
/usr/lib/libQtGui.so.4(_ZN7QWidgetD2Ev+0x153)[0x219b573]
./qt[0x80489a4]
/lib/libc.so.6(__libc_start_main+0xe6)[0x832e36]
./qt[0x8048841]
======= Memory map: ========
00101000-00234000 r-xp 00000000 fd:00 14891 /usr/lib/libX11.so.6.3.0
00234000-00238000 rw-p 00132000 fd:00 14891 /usr/lib/libX11.so.6.3.0
0023a000-002c8000 r-xp 00000000 fd:00 14716 /usr/lib/libfreetype.so.6.6.0
002c8000-002cc000 rw-p 0008d000 fd:00 14716 /usr/lib/libfreetype.so.6.6.0
002ce000-00301000 r-xp 00000000 fd:00 14801 /usr/lib/libfontconfig.so.1.4.4
00301000-00303000 rw-p 00032000 fd:00 14801 /usr/lib/libfontconfig.so.1.4.4
00305000-00313000 r-xp 00000000 fd:00 16201 /usr/lib/libXi.so.6.1.0
00313000-00314000 rw-p 0000d000 fd:00 16201 /usr/lib/libXi.so.6.1.0
00314000-00316000 r-xp 00000000 fd:00 6670 /usr/lib/gconv/UTF-16.so
00316000-00317000 r--p 00001000 fd:00 6670 /usr/lib/gconv/UTF-16.so
00317000-00318000 rw-p 00002000 fd:00 6670 /usr/lib/gconv/UTF-16.so
00318000-00323000 r-xp 00000000 fd:00 6412 /lib/libnss_files-2.13.so
00323000-00324000 r--p 0000a000 fd:00 6412 /lib/libnss_files-2.13.so
00324000-00325000 rw-p 0000b000 fd:00 6412 /lib/libnss_files-2.13.so
00325000-00327000 r-xp 00000000 fd:00 16554 /usr/lib/libXcomposite.so.1.0.0
00327000-00328000 rw-p 00001000 fd:00 16554 /usr/lib/libXcomposite.so.1.0.0
00328000-0032a000 r-xp 00000000 fd:00 27677 /usr/lib/gtk-2.0/modules/libpk-gtk-module.so
0032a000-0032b000 rw-p 00002000 fd:00 27677 /usr/lib/gtk-2.0/modules/libpk-gtk-module.so
0032b000-00330000 r-xp 00000000 fd:00 20389 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
00330000-00331000 rw-p 00004000 fd:00 20389 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
00331000-00336000 r-xp 00000000 fd:00 14093 /usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.so
00336000-00337000 rw-p 00004000 fd:00 14093 /usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.so
00339000-0033b000 r-xp 00000000 fd:00 15985 /usr/lib/libXinerama.so.1.0.0
0033b000-0033c000 rw-p 00001000 fd:00 15985 /usr/lib/libXinerama.so.1.0.0
0033c000-003f3000 r-xp 00000000 fd:00 16566 /usr/lib/libgdk-x11-2.0.so.0.2200.0
003f3000-003f6000 rw-p 000b7000 fd:00 16566 /usr/lib/libgdk-x11-2.0.so.0.2200.0
003fd000-00404000 r-xp 00000000 fd:00 16216 /usr/lib/libXrandr.so.2.2.0
00404000-00405000 rw-p 00006000 fd:00 16216 /usr/lib/libXrandr.so.2.2.0
00407000-0040b000 r-xp 00000000 fd:00 16503 /usr/lib/libXfixes.so.3.1.0
0040b000-0040c000 rw-p 00003000 fd:00 16503 /usr/lib/libXfixes.so.3.1.0
0040e000-00416000 r-xp 00000000 fd:00 15071 /usr/lib/libXrender.so.1.3.0
00416000-00417000 rw-p 00008000 fd:00 15071 /usr/lib/libXrender.so.1.3.0
...
...
At this stage the tutorial is only a tiny few lines of code, but I removed as much of it as I could while still reproducing the crash, and it seems that setting the layout in the window causes the problem.@
int main(int argv, char **args)
{
QApplication app(argv, args);QVBoxLayout layout;
QWidget window;window.setLayout(&layout); // <- no problem if either this line or the following line is commented out
window.show();return app.exec();
}
@Obviously my googling didn't turn up anything useful, so I thought I would ask here in case I am missing something...?
-
This problem is explained "here":http://developer.qt.nokia.com/forums/viewthread/2253
-
ah crap... I just knew that if I started a new topic it would have been covered somewhere that I missed.
Anyway the answer makes perfect sense - thanks for the quick response.I wonder if the tutorial could be amended, since it is the first thing people do when evaluating whether to take up Qt for their projects and this issue doesn't exactly work wonders for their learning curve.
-
[quote author="iforce2d" date="1300803449"]ah crap... I just knew that if I started a new topic it would have been covered somewhere that I missed.
Anyway the answer makes perfect sense - thanks for the quick response.I wonder if the tutorial could be amended, since it is the first thing people do when evaluating whether to take up Qt for their projects and this issue doesn't exactly work wonders for their learning curve.[/quote]
A "bug report":http://bugreports.qt.nokia.com/browse/QTWEBSITE-161 is open for this.