diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-06-01 11:54:45 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-13 19:58:08 +0200 |
commit | 85d27945ac3f4a82e659f8df294b75b6f302f2db (patch) | |
tree | 467587fa82cef70352deb8743a1efc00cdeec032 /src/gui/doc/snippets/textdocument-selections/mainwindow.cpp | |
parent | e08f6d601de4faea869dcfd05a7e133366328981 (diff) | |
download | qtbase-85d27945ac3f4a82e659f8df294b75b6f302f2db.tar.gz |
QPainter: replace manual memory management [2/5]: state/states
Use unique_ptr to indicate ownership. Use std::stack to enforce
stack-ness (QStack doesn't). Requires the addition of a clear()
function, for which we spin a SmallStack wrapper. It also helps to not
have to repeat the value_type...
Because we use unique_ptr, `state` and `states` are now exclusive
(before, `state` was always `states.back()`). Correspondingly, rename
`states` → `savedStates`.
As a drive-by, this fixes an off-by-one error in a qWarning() (checked
`> 1`, but reported one saved state too many).
Change-Id: I8faade59300401be802ddc52c64ce31b8f23dc52
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/doc/snippets/textdocument-selections/mainwindow.cpp')
0 files changed, 0 insertions, 0 deletions