From 8c9d6a334c695aea2ea6492466bb5b0e6f26c17d Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Wed, 25 Feb 2015 11:05:29 +0100 Subject: [PATCH] Doc: Change Q_CHECK_PTR documentation to match implementation Task-number: QTBUG-9134 Change-Id: I417be34f5682fa23b7b76131f5713b0917dfae6d Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7913af3103..abd9f4f593 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2813,12 +2813,15 @@ QString QSysInfo::prettyProductName() \macro void Q_CHECK_PTR(void *pointer) \relates - If \a pointer is 0, prints a warning message containing the source + If \a pointer is 0, prints a message containing the source code's file name and line number, saying that the program ran out - of memory. + of memory and aborts program execution. It throws \c std::bad_alloc instead + if exceptions are enabled. - Q_CHECK_PTR does nothing if \c QT_NO_DEBUG was defined during - compilation. + Q_CHECK_PTR does nothing if \c QT_NO_DEBUG and \c QT_NO_EXCEPTIONS were + defined during compilation. Therefore you must not use Q_CHECK_PTR to check + for successful memory allocations because the check will be disabled in + some cases. Example: