From 14dabf0f354b4f3817393d9b9e52473f88b896da Mon Sep 17 00:00:00 2001 From: David Fries Date: Tue, 25 Sep 2012 23:39:13 -0500 Subject: clear XSizeHints before use Always clear the XSizeHints before retrieving with XGetWMNormalHints because if the window doesn't have size hints set the structure will remain uninitalized. Clear XSizeHints in other locations as well just to be safe. Task-number: QTBUG-15418 Change-Id: Ia9a0c485389bf27016ee7f206a3a916d0bbcbcfa Signed-off-by: David Fries Reviewed-by: Marc Mutz --- src/gui/kernel/qapplication_x11.cpp | 1 + src/gui/kernel/qwidget_x11.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 22f7e19..c287d81 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -602,6 +602,7 @@ public: // static gravity! XSizeHints sh; + memset(&sh, 0, sizeof(sh)); long unused; XGetWMNormalHints(X11->display, internalWinId(), &sh, &unused); sh.flags |= USPosition | PPosition | USSize | PSize | PWinGravity; diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index aec4ade..fa910aa 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -780,6 +780,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO // note: WM_TRANSIENT_FOR is set in QWidgetPrivate::show_sys() XSizeHints size_hints; + memset(&size_hints, 0, sizeof(size_hints)); size_hints.flags = USSize | PSize | PWinGravity; size_hints.x = data.crect.left(); size_hints.y = data.crect.top(); @@ -2298,7 +2299,7 @@ static void do_size_hints(QWidget* widget, QWExtra *x) { Q_ASSERT(widget->testAttribute(Qt::WA_WState_Created)); XSizeHints s; - s.flags = 0; + memset(&s, 0, sizeof(s)); if (x) { QRect g = widget->geometry(); s.x = g.x(); -- cgit v0.12