Make sure that QCocoaWindowManager is initialized in static builds
If code has no external references, then with a static build of Qt the linker is free to strip those object files from the final executable. This is what happened with QCocoaWindowManager, which had no exported symbols, and no callers from other files. To prevent the linker from stripping the object file and to ensure that the constructor function gets called during startup, move that function declaration to the QCocoaIntegration code, which is always loaded. Fixes: QTBUG-99280 Pick-to: 6.2 6.3 Change-Id: Icdafea372a1b42c6ecdb43e36aeb0a04a70e3d4e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
bde2764ab0
commit
d99800dcac
@ -57,6 +57,7 @@
|
||||
#if QT_CONFIG(sessionmanager)
|
||||
# include "qcocoasessionmanager.h"
|
||||
#endif
|
||||
#include "qcocoawindowmanager.h"
|
||||
|
||||
#include <qpa/qplatforminputcontextfactory_p.h>
|
||||
#include <qpa/qplatformaccessibility.h>
|
||||
@ -81,6 +82,11 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpa, "qt.qpa", QtWarningMsg);
|
||||
|
||||
// Lives here so that the linker is forced to include the QCocoaWindowManager
|
||||
// object file also in static builds.
|
||||
static void initializeWindowManager() { Q_UNUSED(QCocoaWindowManager::instance()); }
|
||||
Q_CONSTRUCTOR_FUNCTION(initializeWindowManager)
|
||||
|
||||
static void logVersionInformation()
|
||||
{
|
||||
if (!lcQpa().isInfoEnabled())
|
||||
|
@ -116,8 +116,5 @@ void QCocoaWindowManager::modalSessionChanged()
|
||||
}
|
||||
}
|
||||
|
||||
static void initializeWindowManager() { Q_UNUSED(QCocoaWindowManager::instance()); }
|
||||
Q_CONSTRUCTOR_FUNCTION(initializeWindowManager)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user