summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdatabuffer_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qdatabuffer_p.h')
-rw-r--r--src/gui/painting/qdatabuffer_p.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 1e62c8d924..8f467afe4e 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -89,13 +89,16 @@ public:
}
void shrink(qsizetype size) {
+ Q_ASSERT(capacity >= size);
capacity = size;
if (size) {
buffer = (Type*) realloc(static_cast<void*>(buffer), capacity * sizeof(Type));
Q_CHECK_PTR(buffer);
+ siz = std::min(siz, size);
} else {
free(buffer);
buffer = nullptr;
+ siz = 0;
}
}