Results 1 to 10 of 10

Thread: QObject::moveToThread() warnings

  1. #1
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QObject::moveToThread() warnings

    Hello,

    I'm simply using the Designer to create a window. When I call setupUi(this) there are a few warning messages appearing.

    Qt Code:
    1. QObject::moveToThread: Current thread (0204C070) is not the object's thread (003FEF78).
    2. Cannot move to target thread (003FEF78)
    To copy to clipboard, switch view to plain text mode 

    They come when Qt loads it's image plugins but at this point only the main thread exists ... so how to prevent these warnings? Am I doing something wrong?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    Are you using threads in your application?

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    Most likely you are creating the object in a different thread than the GUI thread.

    Is this necessary? You should instead emit a signal from the thread to the interface to create your object when it is needed.

    Marcel

  4. #4
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    As I told at this point only one thread exists. And yes, I'm using threads but not at this point of initialization.

    I think the problem is more that my program is statically linked and tries to load the "imageformat/qjpegd.dll". So maybe the warning reason is because of something done in the qjpegd.dll? The object which tries to be moved is the QObject returned by the QPluginLoader::instance()-call.

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    As I told at this point only one thread exists. And yes, I'm using threads but not at this point of initialization.
    Well, with threads its often the case, that we THINK we are doing X, but after carfully inspecting the code, we discover that we are actually doing Y.
    So I think it would be best if you would post relevant code segments (where the ui is initialized, and your thread initializtion).
    I think the problem is more that my program is statically linked and tries to load the "imageformat/qjpegd.dll". So maybe the warning reason is because of something done in the qjpegd.dll? The object which tries to be moved is the QObject returned by the QPluginLoader::instance()-call.
    Possible, but not likely, since then it would always be the case, for other users as well.
    It is easy to test though - make a dummy project, no threads, make a simple ui with the widget you are using and see if this still happens.

    But as I said, code segment would help much more.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    Do you have any static objects derived from QObject in your application?

  7. #7
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    Quote Originally Posted by high_flyer View Post
    Well, with threads its often the case, that we THINK we are doing X, but after carfully inspecting the code, we discover that we are actually doing Y.
    So I think it would be best if you would post relevant code segments (where the ui is initialized, and your thread initializtion).

    Possible, but not likely, since then it would always be the case, for other users as well.
    It is easy to test though - make a dummy project, no threads, make a simple ui with the widget you are using and see if this still happens.

    But as I said, code segment would help much more.
    There is no need for code because this is in Qt source. The first use of QIcon/QPixmap loads the "qjpegd.dll" which results in these warnings. If I remove the DLL, no warnings appear. As jpeg is the only format which can not be statically compiled I don't use it, so I don't care about these warnings. I just wanted to know why they happen

    Quote Originally Posted by jacek View Post
    Do you have any static objects derived from QObject in your application?
    No, there are no static objects. Except of the png lib and static Qt plugins.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::moveToThread() warnings

    Did I understand correctly that you said JPEG couldn't be used as a static plugin? Could you elaborate on that? Maybe a link to the docs? I haven't seen it mentioned anywhere...

  9. #9
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QObject::moveToThread() warnings

    Quote Originally Posted by wysota View Post
    Did I understand correctly that you said JPEG couldn't be used as a static plugin? Could you elaborate on that? Maybe a link to the docs? I haven't seen it mentioned anywhere...
    When you run the configure with "-static" all image plugins are "qt" except of jpeg which stays as "plugin"
    Qt Code:
    1. Third Party Libraries:
    2. ZLIB support............qt
    3. GIF support.............no
    4. JPEG support............plugin
    5. PNG support.............qt
    6. MNG support.............qt
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::moveToThread() warnings

    Yes, but this will be a static plugin which you can then add to your application. It just means jpeg plugin can't be compiled directly into Qt libraries. See the Q_IMPORT_PLUGIN macro.

Similar Threads

  1. class header warnings.
    By impeteperry in forum Newbie
    Replies: 9
    Last Post: 31st May 2006, 05:30
  2. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.