diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-04-18 12:31:49 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-04-19 10:02:00 +0000 |
commit | 0458224743337acef025f53da01beb46eacd4493 (patch) | |
tree | 4a70fb72aa558d9d39dc5d0076fe3e026c62023c /src/gui/opengl/qopenglfunctions_1_0.cpp | |
parent | 8026dc6f361b31e36344a3147aac308620287518 (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_1_0.cpp')
-rw-r--r-- | src/gui/opengl/qopenglfunctions_1_0.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp index 9d5a76380a..4235c9a339 100644 --- a/src/gui/opengl/qopenglfunctions_1_0.cpp +++ b/src/gui/opengl/qopenglfunctions_1_0.cpp @@ -74,12 +74,14 @@ QOpenGLFunctions_1_0::QOpenGLFunctions_1_0() QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0() { - 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_0_Deprecated) + Q_ASSERT(d_1_0_Core->refs.load()); + } + if (d_1_0_Deprecated) { d_1_0_Deprecated->refs.deref(); - Q_ASSERT(d_1_0_Deprecated->refs.load()); + Q_ASSERT(d_1_0_Deprecated->refs.load()); + } } bool QOpenGLFunctions_1_0::initializeOpenGLFunctions() |