1

Qt 4.8 を使用する C++ プログラムがあります。64 ビット Ubuntu 11.10 で gcc 4.6.1 を使用してコンパイルすると、正常に動作します。しかし、gcc 4.3 を使用して 32 ビット SUSE Enterprise Linux (SLES) 11 sp 1 でコンパイルすると、プログラムが終了するたびにクラッシュします。

*** 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)
4

0 に答える 0