QString nested in class declaration result in crash on Ubuntu
Solved
General and Desktop
-
For this example:
#include <QCoreApplication> class Test { QString text; }; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Test* test = new Test[10]; delete test; return a.exec(); }
When I run this example on Ubuntu 16.04, the program crashes, here is the log:
*** Error in `/media/jiangcaiyang/Develop/QtProject/build-TestQStringInNestedClass-Desktop_Qt_5_7_0_GCC_64bit-Debug/TestQStringInNestedClass': munmap_chunk(): invalid pointer: 0x0000000001385ef8 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f1c7d4e4725] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7f1c7d4f0c18] /media/jiangcaiyang/Develop/QtProject/build-TestQStringInNestedClass-Desktop_Qt_5_7_0_GCC_64bit-Debug/TestQStringInNestedClass[0x400b7c] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f1c7d48d830] /media/jiangcaiyang/Develop/QtProject/build-TestQStringInNestedClass-Desktop_Qt_5_7_0_GCC_64bit-Debug/TestQStringInNestedClass[0x400a19] ======= Memory map: ======== 00400000-00402000 r-xp 00000000 08:04 246118 /media/jiangcaiyang/Develop/QtProject/build-TestQStringInNestedClass-Desktop_Qt_5_7_0_GCC_64bit-Debug/TestQStringInNestedClass 00601000-00602000 r--p 00001000 08:04 246118 /media/jiangcaiyang/Develop/QtProject/build-TestQStringInNestedClass-Desktop_Qt_5_7_0_GCC_64bit-Debug/TestQStringInNestedClass 00602000-00603000 rw-p 00002000 08:04 246118 /media/jiangcaiyang/Develop/QtProject/build-TestQStringInNestedClass-Desktop_Qt_5_7_0_GCC_64bit-Debug/TestQStringInNestedClass 0136d000-0138e000 rw-p 00000000 00:00 0 [heap] 7f1c795aa000-7f1c79f69000 r--p 00000000 08:0c 3939668 /usr/lib/locale/locale-archive 7f1c79f69000-7f1c79fd7000 r-xp 00000000 08:0c 1839866 /lib/x86_64-linux-gnu/libpcre.so.3.13.2 7f1c79fd7000-7f1c7a1d7000 ---p 0006e000 08:0c 1839866 /lib/x86_64-linux-gnu/libpcre.so.3.13.2 7f1c7a1d7000-7f1c7a1d8000 r--p 0006e000 08:0c 1839866 /lib/x86_64-linux-gnu/libpcre.so.3.13.2 7f1c7a1d8000-7f1c7a1d9000 rw-p 0006f000 08:0c 1839866 /lib/x86_64-linux-gnu/libpcre.so.3.13.2 7f1c7a1d9000-7f1c7a2e1000 r-xp 00000000 08:0c 1839807 /lib/x86_64-linux-gnu/libm-2.23.so 7f1c7a2e1000-7f1c7a4e0000 ---p 00108000 08:0c 1839807 /lib/x86_64-linux-gnu/libm-2.23.so 7f1c7a4e0000-7f1c7a4e1000 r--p 00107000 08:0c 1839807 /lib/x86_64-linux-gnu/libm-2.23.so 7f1c7a4e1000-7f1c7a4e2000 rw-p 00108000 08:0c 1839807 /lib/x86_64-linux-gnu/libm-2.23.so 7f1c7a4e2000-7f1c7a5f1000 r-xp 00000000 08:0c 1840454 /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1 7f1c7a5f1000-7f1c7a7f0000 ---p 0010f000 08:0c 1840454 /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1 7f1c7a7f0000-7f1c7a7f1000 r--p 0010e000 08:0c 1840454 /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1 7f1c7a7f1000-7f1c7a7f2000 rw-p 0010f000 08:0c 1840454 /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1 7f1c7a7f2000-7f1c7a7f3000 rw-p 00000000 00:00 0 7f1c7a7f3000-7f1c7a7fa000 r-xp 00000000 08:0c 1839891 /lib/x86_64-linux-gnu/librt-2.23.so 7f1c7a7fa000-7f1c7a9f9000 ---p 00007000 08:0c 1839891 /lib/x86_64-linux-gnu/librt-2.23.so 7f1c7a9f9000-7f1c7a9fa000 r--p 00006000 08:0c 1839891 /lib/x86_64-linux-gnu/librt-2.23.so 7f1c7a9fa000-7f1c7a9fb000 rw-p 00007000 08:0c 1839891 /lib/x86_64-linux-gnu/librt-2.23.so 7f1c7a9fb000-7f1c7a9fc000 r-xp 00000000 08:0c 3932557 /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.4800.1 7f1c7a9fc000-7f1c7abfb000 ---p 00001000 08:0c 3932557 /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.4800.1 7f1c7abfb000-7f1c7abfc000 r--p 00000000 08:0c 3932557 /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.4800.1 7f1c7abfc000-7f1c7abfd000 rw-p 00001000 08:0c 3932557 /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.4800.1 7f1c7abfd000-7f1c7ac00000 r-xp 00000000 08:0c 1839761 /lib/x86_64-linux-gnu/libdl-2.23.so 7f1c7ac00000-7f1c7adff000 ---p 00003000 08:0c 1839761 /lib/x86_64-linux-gnu/libdl-2.23.so 7f1c7adff000-7f1c7ae00000 r--p 00002000 08:0c 1839761 /lib/x86_64-linux-gnu/libdl-2.23.so 7f1c7ae00000-7f1c7ae01000 rw-p 00003000 08:0c 1839761 /lib/x86_64-linux-gnu/libdl-2.23.so 7f1c7ae01000-7f1c7c5e4000 r--p 00000000 08:0c 1063174 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1 7f1c7c5e4000-7f1c7c7e3000 ---p 017e3000 08:0c 1063174 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1 7f1c7c7e3000-7f1c7c7e4000 rw-p 017e2000 08:0c 1063174 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1 7f1c7c7e4000-7f1c7c988000 r-xp 00000000 08:0c 1063176 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1 7f1c7c988000-7f1c7cb87000 ---p 001a4000 08:0c 1063176 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1 7f1c7cb87000-7f1c7cb9a000 rw-p 001a3000 08:0c 1063176 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1 7f1c7cb9a000-7f1c7cb9c000 rw-p 00000000 00:00 0 7f1c7cb9c000-7f1c7ce24000 r-xp 00000000 08:0c 1063175 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1 7f1c7ce24000-7f1c7d024000 ---p 00288000 08:0c 1063175 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1 7f1c7d024000-7f1c7d035000 rw-p 00288000 08:0c 1063175 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1 7f1c7d035000-7f1c7d036000 rw-p 00000000 00:00 0 7f1c7d036000-7f1c7d04f000 r-xp 00000000 08:0c 1839928 /lib/x86_64-linux-gnu/libz.so.1.2.8 7f1c7d04f000-7f1c7d24e000 ---p 00019000 08:0c 1839928 /lib/x86_64-linux-gnu/libz.so.1.2.8 7f1c7d24e000-7f1c7d24f000 r--p 00018000 08:0c 1839928 /lib/x86_64-linux-gnu/libz.so.1.2.8 7f1c7d24f000-7f1c7d250000 rw-p 00019000 08:0c 1839928 /lib/x86_64-linux-gnu/libz.so.1.2.8 7f1c7d250000-7f1c7d268000 r-xp 00000000 08:0c 1839883 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f1c7d268000-7f1c7d467000 ---p 00018000 08:0c 1839883 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f1c7d467000-7f1c7d468000 r--p 00017000 08:0c 1839883 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f1c7d468000-7f1c7d469000 rw-p 00018000 08:0c 1839883 /lib/x86_64-linux-gnu/libpthread-2.23.so 7f1c7d469000-7f1c7d46d000 rw-p 00000000 00:00 0 7f1c7d46d000-7f1c7d62d000 r-xp 00000000 08:0c 1839737 /lib/x86_64-linux-gnu/libc-2.23.so 7f1c7d62d000-7f1c7d82c000 ---p 001c0000 08:0c 1839737 /lib/x86_64-linux-gnu/libc-2.23.so 7f1c7d82c000-7f1c7d830000 r--p 001bf000 08:0c 1839737 /lib/x86_64-linux-gnu/libc-2.23.so 7f1c7d830000-7f1c7d832000 rw-p 001c3000 08:0c 1839737 /lib/x86_64-linux-gnu/libc-2.23.so 7f1c7d832000-7f1c7d836000 rw-p 00000000 00:00 0 7f1c7d836000-7f1c7d84c000 r-xp 00000000 08:0c 1839775 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f1c7d84c000-7f1c7da4b000 ---p 00016000 08:0c 1839775 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f1c7da4b000-7f1c7da4c000 rw-p 00015000 08:0c 1839775 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f1c7da4c000-7f1c7dbbe000 r-xp 00000000 08:0c 3932575 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f1c7dbbe000-7f1c7ddbe000 ---p 00172000 08:0c 3932575 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f1c7ddbe000-7f1c7ddc8000 r--p 00172000 08:0c 3932575 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f1c7ddc8000-7f1c7ddca000 rw-p 0017c000 08:0c 3932575 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f1c7ddca000-7f1c7ddce000 rw-p 00000000 00:00 0 7f1c7ddce000-7f1c7e2d7000 r-xp 00000000 08:0c 1063268 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5.7.0 7f1c7e2d7000-7f1c7e4d7000 ---p 00509000 08:0c 1063268 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5.7.0 7f1c7e4d7000-7f1c7e4e6000 rw-p 00509000 08:0c 1063268 /home/jiangcaiyang/Develop/Qt5.7.0/5.7/gcc_64/lib/libQt5Core.so.5.7.0 7f1c7e4e6000-7f1c7e4e9000 rw-p 00000000 00:00 0 7f1c7e4e9000-7f1c7e50f000 r-xp 00000000 08:0c 1839709 /lib/x86_64-linux-gnu/ld-2.23.so 7f1c7e6e5000-7f1c7e6ef000 rw-p 00000000 00:00 0 7f1c7e70b000-7f1c7e70e000 rw-p 00000000 00:00 0 7f1c7e70e000-7f1c7e70f000 r--p 00025000 08:0c 1839709 /lib/x86_64-linux-gnu/ld-2.23.so 7f1c7e70f000-7f1c7e710000 rw-p 00026000 08:0c 1839709 /lib/x86_64-linux-gnu/ld-2.23.so 7f1c7e710000-7f1c7e711000 rw-p 00000000 00:00 0 7ffc910d8000-7ffc910f9000 rw-p 00000000 00:00 0 [stack] 7ffc91115000-7ffc91117000 r--p 00000000 00:00 0 [vvar] 7ffc91117000-7ffc91119000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Could anyone help me find the solutions?