summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydatapointer.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-01-13 16:51:07 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-18 22:08:05 +0100
commit66f192e29478ea586ff14741a734e590375d5bf2 (patch)
tree4786be46af8e7139df602345315614c03680cd34 /src/corelib/tools/qarraydatapointer.h
parente465a8c58cef94029b11bbb5e53c89833d85d96d (diff)
Move Q_CHECK_PTR to inline code
The behavior of Q_CHECK_PTR is user-configurable. It may throw and exception, output a warning or be a no-op. As such, its best used in inline code that gets compiled into the user application. Moving it out of the QArrayData API also enables this to be used in code that must handle out-of-memory errors without crashing or otherwise issuing warnings. Putting in QArrayDataPointer gives good convenience coverage for those who are implementing containers on top of the QArrayData stack, and covers its use in the SimpleVector test case. It intentionally leaves out the use of allocate to access the (hidden) shared-empties which don't really allocate, anyway (in QArrayDataPointer::clear and setSharable). The autotest is not updated and will have to make do without the Q_CHECK_PTR "protection". I think that is ok. Change-Id: Idcad909903a9807866bf23ace89f1bf1edc53c3b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydatapointer.h')
-rw-r--r--src/corelib/tools/qarraydatapointer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 1539b3672f..81eae4cf81 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -73,6 +73,7 @@ public:
explicit QArrayDataPointer(QTypedArrayData<T> *ptr)
: d(ptr)
{
+ Q_CHECK_PTR(ptr);
}
QArrayDataPointer &operator=(const QArrayDataPointer &other)