diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 239d873649b..8d8764b76be 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -2401,17 +2401,19 @@ int QStyle::combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, const QStyle * QStyle::proxy() const { Q_D(const QStyle); - return d->proxyStyle; + return d->proxyStyle == this ? this : d->proxyStyle->proxy(); } /* \internal This function sets the base style that style calls will be - redirected to. Note that ownership is not transferred. + redirected to. Note that ownership is not transferred. \a style + must be a valid pointer (not nullptr). */ void QStyle::setProxy(QStyle *style) { Q_D(QStyle); + Q_ASSERT(style); d->proxyStyle = style; }