QMutex error : destroying locked mutex
-
Hi All,
I have used Qmutex in my project and when i close the application getting an crash saying "destroying locked mutex". Then i removed the use of mutex variables and then also i am getting the same error. I have used threads in my application and quitting them once work is done. Not sure from where i am getting this mutex error.
I have used QSharedmemory in my application to make the application to have only one instance at a given point of time. Even i removed that, but still getting the error.Please suggest us how we can solve this issue.
Thanks & Regards,
Pradeep -
@Pradeep-NS The error message tells you what the problem is: you are destroying a locked mutex. So, when your app is closed there is a locked mutex which then destroyed. You need to make sure you unlock the mutex when exiting the application.
Please also check documentation: https://doc.qt.io/qt-5/qmutex.html#dtor.QMutex -
@Pradeep-NS Are you sure you removed all mutexes?
Did you do a complete rebuild of your application (delete build folder, run qmake and build)?
Also if your app is crashing you can run it in debugger and check the stack trace to see where exactly it is crashing (use debug build). -
Run with
QT_FATAL_WARNINGS
environment variable set and extract a stack trace. Paste it here.