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

CoInitializeEx in QApplication restricts further CoInitializeEx

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.3.1
    • Widgets: Main Window
    • None

    Description

      Hi,

      I noticed that somewhere deep in QApplication is a call to CoInitializeEx that makes the thread go into STA (single threaded apartment) mode. This is highly undesirable as subsequent calls to COM objects will likewise be STA which in many cases requires running an event loop.

      I'm wondering why we need this call and if we can disable it. My program looks like:

      QApplication a(argc, argv);
      auto hardware= new Hardware(0);//where CoInitializeEx(NULL, COINIT_SPEED_OVER_MEMORY | COINIT_MULTITHREADED); is called.

      Even if this disables functionality (drag 'n drop?), having such a flag would be preferable as i'm struggling to write my program which must use certain libraries as MTA.

      I appear to be one of many who has run into this problem a similar discussion can be found here: http://stackoverflow.com/questions/2979113/qcroreapplication-qapplication-with-wmi

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              kandel3 Mikhail Kandel
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes