summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydatapointer.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-08-24 10:53:58 +0200
committerQt by Nokia <qt-info@nokia.com>2012-09-11 23:54:57 +0200
commit975ebdc4ab77d1c0d8bc91e393eca7095a5d8742 (patch)
tree424f05539ece68cd28256e100527bb5eaf54fa57 /src/corelib/tools/qarraydatapointer.h
parentf3707a5a0c4483b15e7bb2ba9f0e7d1913a713ee (diff)
Don't manipulate immutable data
QArrayData can point to data it does not own (cf. fromRawData()), which shouldn't be modified. Not even upon destruction, as this data can live in Read-Only memory or be otherwise shared outside the QArrayData realm. Change-Id: I8bdf3050a17802fb003b77d5f543fe31769a7710 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andreas Hartmetz <ahartmetz@gmail.com>
Diffstat (limited to 'src/corelib/tools/qarraydatapointer.h')
-rw-r--r--src/corelib/tools/qarraydatapointer.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 65ebc296d4..724edca947 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -115,7 +115,8 @@ public:
~QArrayDataPointer()
{
if (!d->ref.deref()) {
- (*this)->destroyAll();
+ if (d->isMutable())
+ (*this)->destroyAll();
Data::deallocate(d);
}
}