summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qhash.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 624d647c72..25c00ce26f 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -850,7 +850,11 @@ public:
else
d = Data::detached(d, size_t(size));
}
- inline void squeeze() { reserve(0); }
+ inline void squeeze()
+ {
+ if (capacity())
+ reserve(0);
+ }
inline void detach() { if (!d || d->ref.isShared()) d = Data::detached(d); }
inline bool isDetached() const noexcept { return d && !d->ref.isShared(); }