Autotest: fix use of dangling pointer
The "data" pointer became technically dangling after line 1866 did copy = data; as copy was the last reference to the original data. That made the pointer address available to be reused by the system malloc(), which sometimes happened, causing the unit test to fail. Discussed-on: http://lists.qt-project.org/pipermail/development/2014-April/016588.html Change-Id: Ifa6a27bd53a6e60392b77a6609f2d47148695211 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
f9d7f85079
commit
02a9f065c5
@ -1863,7 +1863,7 @@ void tst_QByteArray::reserve()
|
||||
QCOMPARE(qba.capacity(), capacity);
|
||||
QCOMPARE(copy.capacity(), capacity);
|
||||
|
||||
copy = qba;
|
||||
qba = copy;
|
||||
qba.reserve(capacity * 2);
|
||||
QCOMPARE(qba.size(), capacity);
|
||||
QCOMPARE(qba.capacity(), capacity * 2);
|
||||
|
Loading…
Reference in New Issue
Block a user