У меня есть программа на C ++, которая использует Qt 4.8. При компиляции с gcc 4.6.1 на 64-битной Ubuntu 11.10 работает нормально. Но при компиляции в 32-битной SUSE Enterprise Linux (SLES) 11 sp 1 с gcc 4.3, каждый раз, когда программа закрывается, происходит сбой
*** glibc detected *** /opt/myprogram: corrupted double-linked list: 0x0821dfb0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6d3d4)[0xb6fd93d4]
/lib/libc.so.6(+0x6d929)[0xb6fd9929]
/lib/libc.so.6(+0x6ec7f)[0xb6fdac7f]
/lib/libc.so.6(cfree+0x6d)[0xb6fddcfd]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb71bd291]
/opt/ncrue/lib/libQtCore.so.4(_ZN8QMapData16continueFreeDataEi+0x59)[0xb72bdf49]
/opt/ncrue/lib/libQtCore.so.4(+0xc09e3)[0xb72d39e3]
/opt/ncrue/lib/libQtCore.so.4(+0xb0434)[0xb72c3434]
/opt/ncrue/lib/libQtCore.so.4(+0xc17df)[0xb72d47df]
/lib/libc.so.6(+0x2dbe1)[0xb6f99be1]
/lib/libc.so.6(+0x2dc3f)[0xb6f99c3f]
/lib/libc.so.6(__libc_start_main+0xed)[0xb6f82bed]
/opt/myprogram[0x80554c1]
valgrind дает не очень полезную информацию о ссылках на уже освобожденные блоки памяти, но все это происходит после main()
заканчивается.
Я совершенно в тупик о том, как это исправить. Кто-нибудь имеет представление о том, что происходит или как это выяснить?
ETA: Вот вывод valgrind по запросу.
==24079== Invalid read of size 4
==24079== at 0x7CE03B2: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x68693E2: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x681DB72: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x8055F82: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
==24079==
==24079== Invalid read of size 4
==24079== at 0x4188F32: __tcf_0 (qatomic_i386.h:132)
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x40787C3: ??? (in /opt/ncrue/lib/libDataFileAccess.so.1.2.0)
==24079== by 0x419802F: ??? (in /opt/ncrue/lib/libDataFileAccess.so.1.2.0)
==24079== by 0x400FB3A: _dl_fini (in /lib/ld-2.11.1.so)
==24079== by 0x482EBE0: __run_exit_handlers (in /lib/libc-2.11.1.so)
==24079== by 0x482EC3E: exit (in /lib/libc-2.11.1.so)
==24079== by 0x4817BEC: (below main) (in /lib/libc-2.11.1.so)
==24079== Address 0x6a0aec0 is 0 bytes inside a block of size 42 free'd
==24079== at 0x4028FE1: free (vg_replace_malloc.c:446)
==24079== by 0x444107C: qFree(void*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x449923F: QString::free(QString::Data*) (in /opt/ncrue/lib/libQtCore.so.4.8.0)
==24079== by 0x5F165E5: ???
==24079== by 0x482EF87: __cxa_finalize (in /lib/libc-2.11.1.so)
==24079== by 0x5E2BBA3: ???
==24079== by 0x5F4B47F: ???
==24079== by 0x4014356: _dl_close_worker (in /lib/ld-2.11.1.so)
==24079== by 0x4014CE6: _dl_close (in /lib/ld-2.11.1.so)
==24079== by 0x549ECF3: dlclose_doit (in /lib/libdl-2.11.1.so)
==24079== by 0x400F125: _dl_catch_error (in /lib/ld-2.11.1.so)
==24079== by 0x549F11B: _dlerror_run (in /lib/libdl-2.11.1.so)
Задача ещё не решена.
Других решений пока нет …