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.

Pick-to: 6.1
Change-Id: I8fc458b7e9ba8904ec7a3b1c26aac0628e336ea2
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
bb10
Volker Hilsheimer 2021-03-01 11:16:51 +01:00
parent 4a037e86d4
commit 4daf83a0dc
1 changed files with 2 additions and 2 deletions

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));
}
}