Qt: Display memory cleanup

This commit is contained in:
Vicki Pfau 2020-07-31 01:31:49 -07:00
parent 8ee4b3c046
commit 8a9a8859a6
2 changed files with 5 additions and 8 deletions

View File

@ -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();

View File

@ -25,6 +25,8 @@
#include <QThread>
#include <QTimer>
#include <array>
#include "VideoProxy.h"
#include "platform/video-backend.h"
@ -119,6 +121,7 @@ private:
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;