diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index b5759e8cf..c6ccbe9bc 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -327,18 +327,12 @@ PainterGL::PainterGL(QWindow* surface, QOpenGLContext* parent, int forceVersion) m_backend->lockAspectRatio = false; m_backend->interframeBlending = false; - for (int i = 0; i < 3; ++i) { - m_free.append(new uint32_t[1024 * 2048]); + for (auto& buf : m_buffers) { + m_free.append(&buf.front()); } } PainterGL::~PainterGL() { - while (!m_queue.isEmpty()) { - delete[] m_queue.dequeue(); - } - for (auto item : m_free) { - delete[] item; - } m_gl->makeCurrent(m_surface); #if defined(_WIN32) && defined(USE_EPOXY) epoxy_handle_external_wglMakeCurrent(); diff --git a/src/platform/qt/DisplayGL.h b/src/platform/qt/DisplayGL.h index 6948eec96..84463069a 100644 --- a/src/platform/qt/DisplayGL.h +++ b/src/platform/qt/DisplayGL.h @@ -25,6 +25,8 @@ #include #include +#include + #include "VideoProxy.h" #include "platform/video-backend.h" @@ -119,6 +121,7 @@ private: void dequeue(); void dequeueAll(); + std::array, 3> m_buffers; QList m_free; QQueue m_queue; uint32_t* m_buffer;