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. ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread.
QtWS25 Last Chance

ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread.

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 3.6k Views
  • 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    this assert failure is not always met, and it's hard to find where is the bug?
    is there anyway to check all the code, and find the bug(eg.update ui in no-main thread) while compile time?
    when the exe runs, when click "retry" the ASSERT, the debug point stop seems nothing wrong...
    thank you !

    1 Reply Last reply
    0
    • O Offline
      O Offline
      opengpu2
      wrote on last edited by
      #2

      is there any way or tools which can check all the code is right, especially the UI controlllers are all update in main thread.

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        This could be coming in show method of UI as well. You are calling some function of a object in worker thread. This object is owned by the different thread. Internally that function must be calling the sendevent. This could simple show() function your widget as well.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0
        • O Offline
          O Offline
          opengpu2
          wrote on last edited by
          #4

          sorry, but i am not quite understand what you mean by show()...
          the bug is possibly cause by calling ui's func in no-main thread.
          but the compilation is right, and just ASSERT sometime when running.
          i want to know is there any way to find out the wrongly used code , it's better if i can find all the wrong code while compiling.
          thank you any way

          jsulmJ 1 Reply Last reply
          0
          • O opengpu2

            sorry, but i am not quite understand what you mean by show()...
            the bug is possibly cause by calling ui's func in no-main thread.
            but the compilation is right, and just ASSERT sometime when running.
            i want to know is there any way to find out the wrongly used code , it's better if i can find all the wrong code while compiling.
            thank you any way

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by jsulm
            #5

            @opengpu2 Well, there are no such tools. And it will compile, its not an compile time issue. You need to check your code - especially your threads.

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

            O 1 Reply Last reply
            1
            • jsulmJ jsulm

              @opengpu2 Well, there are no such tools. And it will compile, its not an compile time issue. You need to check your code - especially your threads.

              O Offline
              O Offline
              opengpu2
              wrote on last edited by
              #6

              @jsulm thank you, but when the solution is a very big one, there too many codes...and it's not easy to check all the code...
              and when debug runnuing, it sometims will assert, but when click retry, the breakpoint position seems not where the bug is...
              why the breakpoint not locate precisly when click the retry button when Assert?

              1 Reply Last reply
              0
              • O Offline
                O Offline
                opengpu2
                wrote on last edited by
                #7

                anyone help?

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

                  Try running thread sanitizer, maybe it will pinpoint the issue.

                  (Z(:^

                  1 Reply Last reply
                  0

                  • Login

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