QMutex: destroying locked mutex
m beginner in Qt. I watched Voidrealms tutorial (C++ Qt 31 - QThread part 4 threads with a GUI). when i want to create & run similar project, in Application output appears "QMutex: destroying locked mutex" & the thread doesnt work. even original project that wriitten by voidRealms doesn
t work for me. whats the problem?
Thanks a lot.
If you can't avoid locking in your code, I think the best best solution is to use QMutexLocker class: it is much less error-prone.
Did you get your answer? I have the same issue. How far you have gone in that set of videos?
Hi dear Saham.
I didn`t use mutex after this question but I think my problem solved by adding QObject::connect to connect signal & slot!
I had forgotten to add this code! :)
but it didnt help me. So I am going to give up and move on :)
Did you include #include <QThread> in mythread.h? change it to #include <QtCore> to solve problem
[quote author="itsi" date="1398243096"]Did you include #include <QThread> in mythread.h? change it to #include <QtCore> to solve problem[/quote]
I would not recommend this. Including the whole QtCore will increase the compilation time a lot. Include only what you use, use forward declarations where possible, and you will compile about 40% faster.
Thanks sierdzio for recommendation, QThread is enough and faster.
I found solution for sole problem:
Just add thread->Stop = false in Start button's triggered to make sure it starts.
i confirm that what @itsi recommends really helped. thanks a lot!