QMutex: destroying locked mutex
-
wrote on 6 Mar 2014, 07:07 last edited by
Hello friends.
I
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 doesn
t work. even original project that wriitten by voidRealms doesnt work for me. what
s the problem?Thanks a lot.
Ya Ali. -
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.
-
wrote on 9 Apr 2014, 23:46 last edited by
Hi Mohammad
Did you get your answer? I have the same issue. How far you have gone in that set of videos?
Thanks
-
wrote on 10 Apr 2014, 13:02 last edited by
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! :) -
wrote on 10 Apr 2014, 22:09 last edited by
but it didnt help me. So I am going to give up and move on :)
-
wrote on 23 Apr 2014, 08:51 last edited by
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.
-
wrote on 23 Apr 2014, 09:13 last edited by
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. -
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.