[Qt-interest] QMutex deadlock without using QMutex

Andre Somers andre at familiesomers.nl
Tue Apr 27 18:11:00 CEST 2010


On 27-4-2010 17:49, Brad Howes wrote:
> On Apr 27, 2010, at 11:32 AM, Andre Somers wrote:
>
>    
>> After setting a breakpoint at the two places where this error can be
>> triggered (qmutex.cpp lines 162 and 200; Qt 4.6.2) I managed to get a trace:
>>
>> 0    QMutex::lock    qmutex.cpp    201    0x00e10f4e
>> 1    QMutexLocker::relock    qmutex.h    120    0x00f5c564
>> 2    QMutexLocker    qmutex.h    102    0x00f5c604
>> 3    QCoreApplicationPrivate::sendPostedEvents
>> qcoreapplication.cpp    1271    0x00efe127
>> 4    qt_internal_proc    qeventdispatcher_win.cpp    482    0x00f1f73f
>> 5    USER32!DefDlgProcW    C:\WINDOWS\syswow64\user32.dll    0
>> 0x7d9472d8
>> 6    ??        0    0x003f06a8
>> 7    ??        0    0x00000401
>> 8    ??        0    0x00000000
>>
>> Following the item at line 3, I notice that Qt is indeed using a mutex
>> for the message passing. So, it seems we are dealing with Qt's mutex,
>> not mine.
>>      
>
> Are your trying to do more signalling while you are responding to a signal? Not knowing the internals, I would hazard a guess that that could cause a (self) deadlock. QMutex supports recursive locking, but I have no idea if the QMutex used in sendPostedEvents was created in that manner.
>
>    
I took a peek in the Qt sources: that mutex is not a recursive mutex. 
Perhaps that could be the problem?

André




More information about the Qt-interest-old mailing list