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 <Friedemann.Kleint@qt.io>
This commit is contained in:
Marc Mutz 2019-08-15 14:00:25 +02:00
parent 2dee006216
commit 36cf237ea1

View File

@ -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) {