From 5af06405a61a571fd79f186bf535d9fab957bec1 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 1 Mar 2021 11:16:51 +0100 Subject: [PATCH] Don't access data in moved-from object It's undefined behavior, esp since we leave it to the compiler to implement a move constructor for the ButtonInfo struct. So read the data that we need first. Fixes static analyzer warning de76eedae524c86f89d6369c0f5af8c7. Change-Id: I8fc458b7e9ba8904ec7a3b1c26aac0628e336ea2 Reviewed-by: Doris Verria Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 4daf83a0dc05f944c066237aa95c388f29ce890a) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qstylesheetstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index a200cc0cd1d..cef61763eeb 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -863,9 +863,9 @@ QHash QStyleSheetStyle::titleBarLayout(const QWidget info.rule = subRule; info.offset = offsets[where]; info.where = where; - infos.append(std::move(info)); - offsets[where] += info.width; + + infos.append(std::move(info)); } }