Increment reference count when restoring reference

Otherwise the count will be wrong after an out of memory failure in
reinterpretAsFormat.

Pick-to: 6.2 5.15
Fixes: QTBUG-98377
Change-Id: Ice51d47a6db9277126a5c7337e14aaf5ddee3a10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
bb10
Allan Sandfeld Jensen 2021-11-16 17:06:21 +01:00
parent fb33e2a8e8
commit 1a8b7eb1d4
1 changed files with 1 additions and 0 deletions

View File

@ -2332,6 +2332,7 @@ bool QImage::reinterpretAsFormat(Format format)
// In case detach() ran out of memory
if (!d) {
d = oldD;
d->ref.ref();
return false;
}
}