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.
Forum Update on Monday, May 27th 2025

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 23 May 2017, 10:25 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 23 May 2017, 10:27 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
      • D Offline
        D Offline
        dheerendra
        Qt Champions 2022
        wrote on 23 May 2017, 10:34 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 23 May 2017, 10:46 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

          J 1 Reply Last reply 23 May 2017, 12:00
          0
          • O opengpu2
            23 May 2017, 10:46

            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

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 23 May 2017, 12:00 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 24 May 2017, 02:04
            1
            • J jsulm
              23 May 2017, 12:00

              @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 24 May 2017, 02:04 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 26 May 2017, 09:04 last edited by
                #7

                anyone help?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sierdzio
                  Moderators
                  wrote on 26 May 2017, 10:27 last edited by
                  #8

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

                  (Z(:^

                  1 Reply Last reply
                  0

                  4/8

                  23 May 2017, 10:46

                  • Login

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