From 9269dcc8ed9839c403f4f88edd79d0b8f0945d4a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 24 Apr 2015 08:50:16 -0700 Subject: [PATCH] Fix compilation of QContiguousCache::operator= freeData() takes a Data*, not a QContiguousCacheData*. Task-number: QTBUG-45783 Change-Id: I96d7ac38dac24b418138ffff13d7fdf09b1d6b07 Reviewed-by: Marc Mutz Reviewed-by: Giuseppe D'Angelo --- src/corelib/tools/qcontiguouscache.h | 2 +- .../tools/qcontiguouscache/tst_qcontiguouscache.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index fc4fb1e7cbc..41d198f9bc3 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -291,7 +291,7 @@ QContiguousCache &QContiguousCache::operator=(const QContiguousCache &o { other.d->ref.ref(); if (!d->ref.deref()) - freeData(d); + freeData(p); d = other.d; if (!d->sharable) detach_helper(); diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp index 01855a730e1..76687bd478f 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp @@ -43,6 +43,8 @@ class tst_QContiguousCache : public QObject { Q_OBJECT private slots: + void assignment(); + void empty(); void swap(); @@ -64,6 +66,16 @@ private slots: QTEST_MAIN(tst_QContiguousCache) +void tst_QContiguousCache::assignment() +{ + // compile-only test: QTBUG-45783 + QContiguousCache cc1, cc2; + // copy: + cc1 = cc2; + // move: + cc1 = qMove(cc2); +} + void tst_QContiguousCache::empty() { QContiguousCache c(10);