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. Getting socket thread gives QObject(0x0).... / cant moveToThread()
Forum Updated to NodeBB v4.3 + New Features

Getting socket thread gives QObject(0x0).... / cant moveToThread()

Scheduled Pinned Locked Moved Solved General and Desktop
qthreadqobjectqtcpsocket
4 Posts 3 Posters 1.2k 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by Dariusz
    #1

    Hey

    I'm trying to deal with my sockets somehow... how do I test for this > QTcpSocket->thread() == QObject(0x0) ?

    I've got this and I dunno how to test against it o.O I expected either nullptr or ptr to thread, not that thing...

    Tips?

    This is my problem >

    QObject::moveToThread: Current thread (0x1447ae1e180) is not the object's thread (0x0). Cannot move to target thread (0x1447ae3ff70)
    

    TIA.

    KroMignonK 1 Reply Last reply
    0
    • D Offline
      D Offline
      Dariusz
      wrote on last edited by
      #3

      My dumb ass set the socket thread to nullptr 1 function before and then I was scratching my head why thread() was retuning QObejct(0x0) and I could not test against nullptr/etc... I'm gifted

      Sorted.

      1 Reply Last reply
      0
      • D Dariusz

        Hey

        I'm trying to deal with my sockets somehow... how do I test for this > QTcpSocket->thread() == QObject(0x0) ?

        I've got this and I dunno how to test against it o.O I expected either nullptr or ptr to thread, not that thing...

        Tips?

        This is my problem >

        QObject::moveToThread: Current thread (0x1447ae1e180) is not the object's thread (0x0). Cannot move to target thread (0x1447ae3ff70)
        

        TIA.

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by
        #2

        @Dariusz said in Getting socket thread gives QObject(0x0).... / cant moveToThread():

        Tips?

        I cannot really understand what you want to do, and also what your main problem is!

        If you want to check if a QTcpSocket runs in current thread, the right test is: QThread::currentThread() == socket->thread()

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        1 Reply Last reply
        1
        • D Offline
          D Offline
          Dariusz
          wrote on last edited by
          #3

          My dumb ass set the socket thread to nullptr 1 function before and then I was scratching my head why thread() was retuning QObejct(0x0) and I could not test against nullptr/etc... I'm gifted

          Sorted.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            FrasierClubb
            Banned
            wrote on last edited by
            #4
            This post is deleted!
            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