Bluetooth Windows: fix segfault in COM de-init
While doing COM initialization/deinitialization, we always implicitly
assumed that QCoreApplication instance is available.
However, if the Bluetooth objects are re-parented to the main
application, the QCoreApplication instance will already be removed by
the time we want to delete the Bluetooth object (and call COM de-init).
Fix it by caching the main application's thread, and using it instead
of QCoreApplication::instance()->thread() in the mainThreadCoUninit()
helper method.
This commit still assumes that all Bluetooth objects are created
*after* the main QCoreApplication instance.
Amends 340b84a5578f78d7a399e369e900ac991d9e0da2.
Fixes: QTBUG-119063
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I450e4e14039ca27fcfd1f3f131789b049e1edb03
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>