Qt: Work around invalid new/delete semantics

This commit is contained in:
Vicki Pfau 2018-07-04 12:47:37 -07:00
parent 3be77c1622
commit 08ec1e89c4
1 changed files with 3 additions and 3 deletions

View File

@ -180,7 +180,7 @@ PainterGL::PainterGL(int majorVersion, QGLWidget* parent)
#if !defined(_WIN32) || defined(USE_EPOXY) #if !defined(_WIN32) || defined(USE_EPOXY)
if (majorVersion >= 2) { if (majorVersion >= 2) {
gl2Backend = new mGLES2Context; gl2Backend = static_cast<mGLES2Context*>(malloc(sizeof(mGLES2Context)));
mGLES2ContextCreate(gl2Backend); mGLES2ContextCreate(gl2Backend);
m_backend = &gl2Backend->d; m_backend = &gl2Backend->d;
m_supportsShaders = true; m_supportsShaders = true;
@ -189,7 +189,7 @@ PainterGL::PainterGL(int majorVersion, QGLWidget* parent)
#ifdef BUILD_GL #ifdef BUILD_GL
if (!m_backend) { if (!m_backend) {
glBackend = new mGLContext; glBackend = static_cast<mGLContext*>(malloc(sizeof(mGLContext)));
mGLContextCreate(glBackend); mGLContextCreate(glBackend);
m_backend = &glBackend->d; m_backend = &glBackend->d;
m_supportsShaders = false; m_supportsShaders = false;
@ -239,7 +239,7 @@ PainterGL::~PainterGL() {
#endif #endif
m_backend->deinit(m_backend); m_backend->deinit(m_backend);
m_gl->doneCurrent(); m_gl->doneCurrent();
delete m_backend; free(m_backend);
m_backend = nullptr; m_backend = nullptr;
} }