title: How to debug and fix this double free memory corruption issue for specific case
body: <p>I have a QT based GUI when I exit the tool, I get this following issue </p>
  
  <pre><code>*** glibc detected *** /bin/linux_x86_64/main-g: double free or corruption 
  (!prev): 0x00000000049eca50 ***
    ======= Backtrace: =========
     /lib64/libc.so.6[0x3feee75e66]
     /lib64/libc.so.6[0x3feee789b3]
      /linux_x86_64/main2- 
     g(_ZN9__gnu_cxx13new_allocatorIPN3zi_14PCommandEE10deallocateEPS3_m+0x20) 
    [0x1d9f504]
   gui//../bin/linux_x86_64/main2-g 
  
    _ZNSt16allocator_traitsISaIPN3zi_14PCommandEEE10deallocateERS3_PS2_m+0x2b) 
    [0x1d9f0de]
   /gui//../bin/linux_x86_64/main2-g   
  (_ZNSt12_Vector_baseIPN3zi_14PCommandESaIS2_EE13_M_deallocateEPS2_m+0x32) 
  [0x1d9eba6]
  /gui//../bin/linux_x86_64/main2- 
   g(_ZNSt12_Vector_baseIPN3zi_14PCommandESaIS2_EED2Ev+0x41)[0x1d9e955]
  ../bin/linux_x86_64/main2-g(_ZNSt6vectorIPN3zi_14PCommandESaIS2_EED1Ev+0x41) 
   [0x1dc771b]
  /lib64/libc.so.6(__cxa_finalize+0x9d)[0x3feee35ebd]
   ../lib/linux_x86_64/lib-g.so(+0x3a627c6)[0x7f63
   ====== Memory map: ========
   00400000-02b5f000 r-xp 00000000 08:03 21767481                           
     ../main2-g
   02d5e000-02f8c000 rw-p 0275e000 08:03 21767481                           
  ../main2-g
    02f8c000-03222000 rw-p 00000000 00:00 0 
  03cc7000-04cac000 rw-p 00000000 00:00 0    
  </code></pre>
  
  <p>I need some inputs to debug this issue. I am also not able to use Valgrind . It crashes before this case                               </p>