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 error : destroying locked mutex
Forum Updated to NodeBB v4.3 + New Features

QMutex error : destroying locked mutex

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.7k 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.
  • P Offline
    P Offline
    Pradeep NS
    wrote on last edited by
    #1

    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

    jsulmJ kshegunovK 2 Replies Last reply
    0
    • P Pradeep NS

      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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      1
      • jsulmJ jsulm

        @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

        P Offline
        P Offline
        Pradeep NS
        wrote on last edited by
        #3

        @jsulm Even i have removed the usage of mutex from my application, but still getting this error message

        jsulmJ 1 Reply Last reply
        0
        • P Pradeep NS

          @jsulm Even i have removed the usage of mutex from my application, but still getting this error message

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #4

          @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).

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • P Pradeep NS

            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

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by kshegunov
            #5

            Run with QT_FATAL_WARNINGS environment variable set and extract a stack trace. Paste it here.

            Read and abide by the Qt Code of Conduct

            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