Fix compilation of QContiguousCache::operator=

freeData() takes a Data*, not a QContiguousCacheData*.

Task-number: QTBUG-45783
Change-Id: I96d7ac38dac24b418138ffff13d7fdf09b1d6b07
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Thiago Macieira 2015-04-24 08:50:16 -07:00 committed by Marc Mutz
parent 9a1283f8d3
commit 9269dcc8ed
2 changed files with 13 additions and 1 deletions

View File

@ -291,7 +291,7 @@ QContiguousCache<T> &QContiguousCache<T>::operator=(const QContiguousCache<T> &o
{
other.d->ref.ref();
if (!d->ref.deref())
freeData(d);
freeData(p);
d = other.d;
if (!d->sharable)
detach_helper();

View File

@ -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<int> cc1, cc2;
// copy:
cc1 = cc2;
// move:
cc1 = qMove(cc2);
}
void tst_QContiguousCache::empty()
{
QContiguousCache<int> c(10);