Qt5 Mac QAudioInput Hates Multi-threading



  • I have a QAudioInput that is a grandchild of an object I am pushing into another thread. On Windows this works out fine: When Grandpa gets pushed onto the new thread, Grandpa's kids and grand kids come along with him. However this is not the case for Mac. When I try to call QAudioInput's start() (no params version), I get these errors and the program stops working:

    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is QAudioInputPrivate(0x10410e420), parent's thread is QThread(0x101c09550), current thread is QThread(0x101970950)
    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is QAudioInputPrivate(0x10410e420), parent's thread is QThread(0x101c09550), current thread is QThread(0x101970950)

    I tried digging around in the source a bit to see if this is a bug in QAudioInputPrivate. It appears that QAudioInputPrivate creates a QIODevice when QAudioInput's param-less start is called and that this QIODevice is properly set as the QAudioInput's child, but I could be mistaken. Eitherway, I'm not sure why I'm getting these error messages.

    Anyone with more knowledge on this topic know a fix?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.