Issue with Qt thread affinity and moveToThread

后端 未结 4 1832
长发绾君心
长发绾君心 2021-01-13 07:58

I\'m trying to use threads in Qt to delegate some work to a thread, but I can\'t get it to work. I have a class inheriting QMainWindow that have a member object that launch

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 08:32

    I think the problem is with the initialization of m_poller, which according to the error message seems to be assigned to a different (third) thread from the one that is executing your code snippet.

    Also, if this code is executed multiple times, it may work the first time but then fail on subsequent times as m_poller no longer belongs to the executing thread, but rather m_pollThread.

提交回复
热议问题