Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
-
-
2a217aba3 (dev)
Description
Q_APPLICATION_STATIC will assert if no application objects exists. This makes it hard to use in cases where we want to transition from Q_GLOBAL_STATIC to Q_APPLICATION_STATIC, and where user code historically can have been used without a Qt application.
We have this need in Qt Multimedia code, where Qt example code previously demonstrated use of QMediaDevices without first having an application object available. Here, we want to tie the lifetime of internal Qt Multimedia objects to the qt application lifetime to prevent releasing Windows Media Foundation instances as part of static destruction because Microsoft documentation states that it is not supported. See [MFShutdown function (mfapi.h) - Win32 apps | Microsoft Learn|https://learn.microsoft.com/en-us/windows/win32/api/mfapi/nf-mfapi-mfshutdown].
At the same time, we don't want to break client code that appeared to work as intended by requiring a Qt application object.
We can argue that an assert in debug is acceptable to make it obvious that user code should be updated. Still, it can break production code if debug builds are being used in products.
Attachments
Issue Links
- relates to
-
QTBUG-124577 Don't use QtGlobalStatic::ApplicationHolder directly in Qt Multimedia
-
- Closed
-