QOpenGLFunctions - move assert inside if statement
Coverity, CIDs 159312-159335, the same pattern: if (ptr) ptr->refs.deref(); Q_ASSERT(ptr->reds.load()); Coverity does not like (and rightfully so) potentially invalid (null) pointer inside Q_ASSERT. Move Q_ASSERT into if-controlled block-statement. Somehow these CIDs were skipped in the previous similar pass/fix. Change-Id: I56f92d964ec0b59a7fdff066fa7231ddd71fd0d3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
50e22c7653
commit
70b8896833
@ -82,36 +82,46 @@ QOpenGLFunctions_1_4::QOpenGLFunctions_1_4()
|
||||
|
||||
QOpenGLFunctions_1_4::~QOpenGLFunctions_1_4()
|
||||
{
|
||||
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_0_Deprecated)
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
if (d_1_1_Deprecated)
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
if (d_1_2_Deprecated)
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
if (d_1_3_Deprecated)
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
if (d_1_4_Deprecated)
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
}
|
||||
}
|
||||
|
||||
bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
|
||||
|
@ -88,48 +88,62 @@ QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
|
||||
|
||||
QOpenGLFunctions_3_0::~QOpenGLFunctions_3_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_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_1_0_Deprecated)
|
||||
Q_ASSERT(d_3_0_Core->refs.load());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
if (d_1_1_Deprecated)
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
if (d_1_2_Deprecated)
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
if (d_1_3_Deprecated)
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
if (d_1_4_Deprecated)
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
}
|
||||
}
|
||||
|
||||
bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
|
||||
|
Loading…
Reference in New Issue
Block a user