diff options
-rw-r--r-- | src/datavisualizationqml2/glstatestore.cpp | 16 | ||||
-rw-r--r-- | src/datavisualizationqml2/glstatestore_p.h | 15 |
2 files changed, 15 insertions, 16 deletions
diff --git a/src/datavisualizationqml2/glstatestore.cpp b/src/datavisualizationqml2/glstatestore.cpp index f053078b..6fbd3a34 100644 --- a/src/datavisualizationqml2/glstatestore.cpp +++ b/src/datavisualizationqml2/glstatestore.cpp @@ -50,13 +50,13 @@ GLStateStore::GLStateStore(QOpenGLContext *context, QObject *parent) : #endif m_maxVertexAttribs = qMin(maxVertexAttribs, 2); // Datavis only uses 2 attribs max - m_vertexAttribArrayEnabledStates = new GLint[maxVertexAttribs]; - m_vertexAttribArrayBoundBuffers = new GLint[maxVertexAttribs]; - m_vertexAttribArraySizes = new GLint[maxVertexAttribs]; - m_vertexAttribArrayTypes = new GLint[maxVertexAttribs]; - m_vertexAttribArrayNormalized = new GLint[maxVertexAttribs]; - m_vertexAttribArrayStrides = new GLint[maxVertexAttribs]; - m_vertexAttribArrayOffsets = new GLint[maxVertexAttribs]; + m_vertexAttribArrayEnabledStates.reset(new GLint[maxVertexAttribs]); + m_vertexAttribArrayBoundBuffers.reset(new GLint[maxVertexAttribs]); + m_vertexAttribArraySizes.reset(new GLint[maxVertexAttribs]); + m_vertexAttribArrayTypes.reset(new GLint[maxVertexAttribs]); + m_vertexAttribArrayNormalized.reset(new GLint[maxVertexAttribs]); + m_vertexAttribArrayStrides.reset(new GLint[maxVertexAttribs]); + m_vertexAttribArrayOffsets.reset(new GLint[maxVertexAttribs]); initGLDefaultState(); } @@ -67,8 +67,6 @@ GLStateStore::~GLStateStore() EnumToStringMap::deleteInstance(); m_map = 0; #endif - delete m_vertexAttribArrayEnabledStates; - delete m_vertexAttribArrayBoundBuffers; } void GLStateStore::storeGLState() diff --git a/src/datavisualizationqml2/glstatestore_p.h b/src/datavisualizationqml2/glstatestore_p.h index 14c46c43..c5023657 100644 --- a/src/datavisualizationqml2/glstatestore_p.h +++ b/src/datavisualizationqml2/glstatestore_p.h @@ -32,6 +32,7 @@ #include <QObject> #include <QtGui/QOpenGLFunctions> #include <QtGui/QOpenGLContext> +#include <QtCore/QScopedArrayPointer> #include "enumtostringmap_p.h" class GLStateStore : public QObject, protected QOpenGLFunctions @@ -66,13 +67,13 @@ public: GLboolean m_isDepthWriteEnabled; GLint m_currentProgram; GLint m_maxVertexAttribs; - GLint *m_vertexAttribArrayEnabledStates; - GLint *m_vertexAttribArrayBoundBuffers; - GLint *m_vertexAttribArraySizes; - GLint *m_vertexAttribArrayTypes; - GLint *m_vertexAttribArrayNormalized; - GLint *m_vertexAttribArrayStrides; - GLint *m_vertexAttribArrayOffsets; + QScopedArrayPointer<GLint> m_vertexAttribArrayEnabledStates; + QScopedArrayPointer<GLint> m_vertexAttribArrayBoundBuffers; + QScopedArrayPointer<GLint> m_vertexAttribArraySizes; + QScopedArrayPointer<GLint> m_vertexAttribArrayTypes; + QScopedArrayPointer<GLint> m_vertexAttribArrayNormalized; + QScopedArrayPointer<GLint> m_vertexAttribArrayStrides; + QScopedArrayPointer<GLint> m_vertexAttribArrayOffsets; GLint m_activeTexture; GLint m_texBinding2D; |