Qt和STL结构之间是否存在不兼容性?

时间:2013-04-16 07:53:49

标签: qt stl

我尝试在Qt应用程序中使用deque,奇怪的是,它似乎不起作用。

我有一个Qt类(派生自QThread),它可以很好地工作,但如果我声明一个stl::deque<int>成员,它会成功构建但在启动时崩溃。我甚至不在任何地方使用该变量。

STL结构是否应该在Qt中使用,特别是在继承基本Qt类的类中?

编辑:

Thread 3 (Thread 172.0x3bc):
#0  0x7c91e514 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll
#1  0x7c91d21a in ntdll!ZwDelayExecution () from C:\WINDOWS\system32\ntdll.dll
#2  0x7c8023f1 in SleepEx () from C:\WINDOWS\system32\kernel32.dll
#3  0x00000000 in ?? ()

Thread 2 (Thread 172.0xb78):
#0  0x7c91e514 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll
#1  0x7c91daaa in ntdll!ZwReplyWaitReceivePortEx () from C:\WINDOWS\system32\ntdll.dll
#2  0x77e565e3 in UuidCreate () from C:\WINDOWS\system32\rpcrt4.dll
#3  0x77e56caf in RPCRT4!I_RpcBindingCopy () from C:\WINDOWS\system32\rpcrt4.dll
#4  0x77e56ad1 in RPCRT4!I_RpcBindingCopy () from C:\WINDOWS\system32\rpcrt4.dll
#5  0x77e56c97 in RPCRT4!I_RpcBindingCopy () from C:\WINDOWS\system32\rpcrt4.dll
#6  0x7c80b729 in KERNEL32!GetModuleFileNameA () from C:\WINDOWS\system32\kernel32.dll
#7  0x00000000 in ?? ()

Thread 1 (Thread 172.0x8d4):
#0  0x7c921689 in ntdll!RtlInitializeHandleTable () from C:\WINDOWS\system32\ntdll.dll
#1  0x7c928ccd in ntdll!RtlRealPredecessor () from C:\WINDOWS\system32\ntdll.dll
#2  0xbaadf00d in ?? ()
#3  0x0a0bc000 in ?? ()
#4  0x7c939ba8 in towlower () from C:\WINDOWS\system32\ntdll.dll
#5  0x7c97fb98 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll
#6  0x7c95b244 in ntdll!LdrFindEntryForAddress () from C:\WINDOWS\system32\ntdll.dll
#7  0x003e0000 in ?? ()
#8  0x7c929c0c in ntdll!RtlpUnWaitCriticalSection () from C:\WINDOWS\system32\ntdll.dll
#9  0x77bfc3c9 in msvcrt!free () from C:\WINDOWS\system32\msvcrt.dll
#10 0x003e0000 in ?? ()
#11 0x77bfc3e7 in msvcrt!free () from C:\WINDOWS\system32\msvcrt.dll
#12 0x00001d40 in ?? ()
#13 0x00224b68 in ?? ()
#14 0x77bfc42e in msvcrt!malloc () from C:\WINDOWS\system32\msvcrt.dll
#15 0x00cef12a in QClipData::initialize (this=0xa093a30) at painting\qpaintengine_raster.cpp:4487
#16 0x00cfa797 in qt_alphamapblit_quint32 (rasterBuffer=0xa099488, x=17, y=207, color=4278190080, map=0xa0ad401 "", mapWidth=9, mapHeight=12, mapStride=256, clip=0xa093a30) at painting\qdrawhelper.cpp:7209
#17 0x00ceb02e in QRasterPaintEngine::alphaPenBlt (this=0x9ff7860, src=0xa0ad401, bpl=256, depth=8, rx=17, ry=207, w=9, h=12) at painting\qpaintengine_raster.cpp:2954
...

另一次运行的堆栈跟踪:

Thread 3 (Thread 1176.0xb4c):
#0  0x7c91e514 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll
#1  0x7c91d21a in ntdll!ZwDelayExecution () from C:\WINDOWS\system32\ntdll.dll
#2  0x7c8023f1 in SleepEx () from C:\WINDOWS\system32\kernel32.dll
#3  0x00000000 in ?? ()

Thread 2 (Thread 1176.0x71c):
#0  0x7c91e514 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll
#1  0x7c91daaa in ntdll!ZwReplyWaitReceivePortEx () from C:\WINDOWS\system32\ntdll.dll
#2  0x77e565e3 in UuidCreate () from C:\WINDOWS\system32\rpcrt4.dll
#3  0x77e56caf in RPCRT4!I_RpcBindingCopy () from C:\WINDOWS\system32\rpcrt4.dll
#4  0x77e56ad1 in RPCRT4!I_RpcBindingCopy () from C:\WINDOWS\system32\rpcrt4.dll
#5  0x77e56c97 in RPCRT4!I_RpcBindingCopy () from C:\WINDOWS\system32\rpcrt4.dll
#6  0x7c80b729 in KERNEL32!GetModuleFileNameA () from C:\WINDOWS\system32\kernel32.dll
#7  0x00000000 in ?? ()

Thread 1 (Thread 1176.0x818):
#0  0x7c921689 in ntdll!RtlInitializeHandleTable () from C:\WINDOWS\system32\ntdll.dll
#1  0x7c928ccd in ntdll!RtlRealPredecessor () from C:\WINDOWS\system32\ntdll.dll
#2  0x00000000 in ?? ()

EDIT2:

使用stl::deque时,控制台说“检测到堆损坏”。我转而使用QQueue,看起来效果很好。

0 个答案:

没有答案