Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMutex: destroying locked mutex
Forum Updated to NodeBB v4.3 + New Features

QMutex: destroying locked mutex

Scheduled Pinned Locked Moved General and Desktop
9 Posts 5 Posters 13.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MohammadReza
    wrote on last edited by
    #1

    Hello friends.

    Im 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 doesnt work for me. whats the problem?

    Thanks a lot.
    Ya Ali.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SahamGhazavi
        wrote on last edited by
        #3

        Hi Mohammad

        Did you get your answer? I have the same issue. How far you have gone in that set of videos?

        Thanks

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MohammadReza
          wrote on last edited by
          #4

          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! :)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SahamGhazavi
            wrote on last edited by
            #5

            but it didnt help me. So I am going to give up and move on :)

            1 Reply Last reply
            0
            • I Offline
              I Offline
              itsi
              wrote on last edited by
              #6

              Did you include #include <QThread> in mythread.h? change it to #include <QtCore> to solve problem

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                [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.

                (Z(:^

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  itsi
                  wrote on last edited by
                  #8

                  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.

                  S 1 Reply Last reply
                  4
                  • I itsi

                    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.

                    S Offline
                    S Offline
                    Stano
                    wrote on last edited by
                    #9

                    i confirm that what @itsi recommends really helped. thanks a lot!

                    1 Reply Last reply
                    1

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved