Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-17017

QTranslator cannot be installed from within other tread than the (application) main thread

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.7.2
    • Core: Locales (i18n)
    • None
    • Maemo, Scratchbox, i486 target

    Description

      Installing a QTranslator from within a worker thread by QCoreApplication::instance()->installTranslator(translator); fails with the following error:
      "ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread bfea5990. Receiver '' (of type 'QCoreApplication') was created in thread 9ffb448", file kernel/qcoreapplication.cpp, line 415"

      The problem root cause is likely using sendEvent which assumes the same thread (whereas postEvent would not?) - a possible fix might be as easy as QCoreApplication sending this particular signal through message queue instead of direct connection.

      This translator is installed deep within a middleware component of which processing we want to move into another thread due to performance reasons. Another potential fix would be changing the middleware component, which would would potentially cause changes in several layers.

      Attached a sample project code for easy repetition of the error.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              buddenha Oswald Buddenhagen
              lsvan Lauri Svan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes