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 <doris.verria@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 4daf83a0dc05f944c066237aa95c388f29ce890a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2021-03-01 11:16:51 +01:00 committed by Qt Cherry-pick Bot
parent cfe5b1b8dd
commit 5af06405a6

View File

@ -863,9 +863,9 @@ QHash<QStyle::SubControl, QRect> 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));
}
}