summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglfunctions_4_4_core.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-04-18 12:31:49 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-04-19 10:02:00 +0000
commit0458224743337acef025f53da01beb46eacd4493 (patch)
tree4a70fb72aa558d9d39dc5d0076fe3e026c62023c /src/gui/opengl/qopenglfunctions_4_4_core.cpp
parent8026dc6f361b31e36344a3147aac308620287518 (diff)
Avoid nullptr deref in Q_ASSERTS
Found by Coverity, CIDs: [159014-159383]. Indeed, Q_ASSERTS can go into the block controlled by the corresponding if-statements, otherwise - why 'if' at all? Change-Id: Ibc99cd48b97287ec132e082d14f3c39350d547f9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui/opengl/qopenglfunctions_4_4_core.cpp')
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp85
1 files changed, 51 insertions, 34 deletions
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
index 95bfc3a438..019a70087a 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
@@ -89,57 +89,74 @@ QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core()
QOpenGLFunctions_4_4_Core::~QOpenGLFunctions_4_4_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()