From 36cf237ea1ca1522e37c3d4e66f08dc00bc3295d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 15 Aug 2019 14:00:25 +0200 Subject: [PATCH] QWidget: two small fixes - Use QPointer::data() instead of a C-style cast - Remove an abuse of Q_UNLIKELY. Q_UNLIKELY is for error code. Using it for conditions that have a good chance of being true in normal operations just caused all the error handling code to be paged in needlessly. Change-Id: I542a5b938b032ca84f2cf1f78fbc45049a12ad1a Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index d098d9cc04..049ddb0213 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6181,7 +6181,7 @@ void QWidget::setFocusProxy(QWidget * w) QWidget *QWidget::focusProxy() const { Q_D(const QWidget); - return d->extra ? (QWidget *)d->extra->focus_proxy : nullptr; + return d->extra ? d->extra->focus_proxy.data() : nullptr; } @@ -11932,7 +11932,7 @@ QOpenGLContext *QWidgetPrivate::shareContext() const #ifdef QT_NO_OPENGL return 0; #else - if (Q_UNLIKELY(!extra || !extra->topextra || !extra->topextra->window)) + if (!extra || !extra->topextra || !extra->topextra->window) return 0; if (!extra->topextra->shareContext) {