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

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

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes