From af499fd7eb4026088ea1ed83a976866ab930dd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 22 Jan 2016 20:40:00 +0000 Subject: Make QWindowGeometrySpecification suitable to use as global It's used as a global static but according to library policy it's required to have a trivial dtor and a trivial or constexpr ctor, otherwise it runs code at library load/unload. Change-Id: I1fcea3ce388b2a198e3851e6d0aeb91ae0a8e4b1 Reviewed-by: Marc Mutz --- src/gui/kernel/qguiapplication.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 65d679cdad..3fe6698955 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -235,11 +235,13 @@ static inline void clearFontUnlocked() QGuiApplicationPrivate::app_font = 0; } +// Using aggregate initialization instead of ctor so we can have a POD global static +#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER { Qt::TopLeftCorner, -1, -1, -1, -1 } + // Geometry specification for top level windows following the convention of the // -geometry command line arguments in X11 (see XParseGeometry). struct QWindowGeometrySpecification { - QWindowGeometrySpecification() : corner(Qt::TopLeftCorner), xOffset(-1), yOffset(-1), width(-1), height(-1) {} static QWindowGeometrySpecification fromArgument(const QByteArray &a); void applyTo(QWindow *window) const; @@ -276,7 +278,7 @@ static inline int nextGeometryToken(const QByteArray &a, int &pos, char *op) QWindowGeometrySpecification QWindowGeometrySpecification::fromArgument(const QByteArray &a) { - QWindowGeometrySpecification result; + QWindowGeometrySpecification result = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER; int pos = 0; for (int i = 0; i < 4; ++i) { char op; @@ -333,7 +335,7 @@ void QWindowGeometrySpecification::applyTo(QWindow *window) const } } -static QWindowGeometrySpecification windowGeometrySpecification; +static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER; /*! \class QGuiApplication -- cgit v1.2.3