CoInitialize(nullptr) in mt app #13979

issue alexeyneu opened this issue on August 15, 2018
  1. alexeyneu commented at 11:23 AM on August 15, 2018: none

    https://github.com/bitcoin/bitcoin/blob/63f8b0128b2aac3b25c6ec4d2f5bda213033162a/src/qt/guiutil.cpp#L548
    it's (at least)a bit risky outside of single-thread apps.

    	CoInitializeEx(NULL,COINIT_MULTITHREADED); 
    

    could be used instead. Only way i know to use it is to make separate thread with init-wait-uninit

  2. fanquake added the label Windows on Aug 15, 2018
  3. kirillkovalenko commented at 7:51 AM on August 17, 2018: none

    UI threads should and in many cases must be introduced into STA apartments, so CoInitialize is fine.

  4. alexeyneu commented at 10:54 AM on August 17, 2018: none

    nothing stops you to introduce(?) it in another thread as mta and then use in gui one. 'should' is a wrong word here . There're cases where it must not ,say IID_ITaskbarList3 .i wanna add it here soon .In current case may be it's safe ,i didnt catch this stuff with shortcuts so cant say more. It's a warning My bet is all part iscopy-pasted from somewhere.

  5. kirillkovalenko commented at 11:31 AM on August 17, 2018: none

    Putting main thread into MTA apartment is not something you usually want in a GUI application. OLE stuff (shell, clipboard, controls hosting, property pages, etc) is designed to work in STA.

    I don't see what is the risk that you mentioned.

  6. MarcoFalke deleted a comment on Aug 17, 2018
  7. alexeyneu commented at 6:48 PM on August 19, 2018: none

    just checked msdn ,looks like it will work if this qt hack provides message queue

  8. alexeyneu closed this on Aug 19, 2018

  9. DrahtBot locked this on Sep 8, 2021
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me