Qt: Display memory cleanup
Vicki Pfau vi@endrift.com
Fri, 31 Jul 2020 01:31:49 -0700
2 files changed,
5 insertions(+),
8 deletions(-)
M
src/platform/qt/DisplayGL.cpp
→
src/platform/qt/DisplayGL.cpp
@@ -327,18 +327,12 @@ m_backend->filter = false;
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();
M
src/platform/qt/DisplayGL.h
→
src/platform/qt/DisplayGL.h
@@ -25,6 +25,8 @@ #include <QQueue>
#include <QThread> #include <QTimer> +#include <array> + #include "VideoProxy.h" #include "platform/video-backend.h"@@ -119,6 +121,7 @@ void performDraw();
void dequeue(); void dequeueAll(); + std::array<std::array<uint32_t, 0x100000>, 3> m_buffers; QList<uint32_t*> m_free; QQueue<uint32_t*> m_queue; uint32_t* m_buffer;