Valgrind found invalid write of size 4


Joined
Apr 14, 2020
Messages
5
Reaction score
0
Hello, I am afraid to say I don't have much experience with allocating specific amounts of memory and therefore don't know much about fixing problems with such code. I ran Valgrind on this old project and it found some problems with some very old code:

C++:
void CMVRendererGL_QSG::DrawLines(int start, int count)
{
    glDisable(GL_CULL_FACE);                                                            GLCHK;
    glDisable(GL_DEPTH_TEST);                                                           GLCHK;

    glDrawArrays(GL_LINES, start, count);                                               GLCHK;
//glUniform4f(Shader::colorHandle, 1.0, 0.0, 1.0, 1.0); GLCHK;
//glDrawArrays(GL_POINTS, start, count); GLCHK;
}

specifically; line 6:

C++:
glDrawArrays(GL_LINES, start, count);                                               GLCHK;

here is the function in question:


C++:
inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
{
#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
    ::glDrawArrays(mode, first, count);
#else
    Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
    d_ptr->f.DrawArrays(mode, first, count);
#endif
    Q_OPENGL_FUNCTIONS_DEBUG
}

Can someone give me an idea based on what's provided of where/what I should be looking at to fix this issue?

Could this be the issue:
#define GL_LINES 0x0001

I am not sure what's happening here exactly...
 
Last edited:
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top