Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString nested in class declaration result in crash on Ubuntu

QString nested in class declaration result in crash on Ubuntu

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 821 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jiancaiyangJ Offline
    jiancaiyangJ Offline
    jiancaiyang
    wrote on last edited by jiancaiyang
    #1

    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?

    我们自己的论坛:http://qtdream.com
    擅长三维角色仿真动画。

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      arrays should be deleted using delete [] test

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      jiancaiyangJ 1 Reply Last reply
      0
      • VRoninV VRonin

        arrays should be deleted using delete [] test

        jiancaiyangJ Offline
        jiancaiyangJ Offline
        jiancaiyang
        wrote on last edited by
        #3

        @VRonin Resolved, it is a basic problem, sorry to trouble you all, my fault...

        我们自己的论坛:http://qtdream.com
        擅长三维角色仿真动画。

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          No problem at all, happens to everybody, happy to help

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved