bootmanager: fix memory leaks when loading save states
This commit is contained in:
parent
7c6d7905a4
commit
8290423d16
@ -104,7 +104,7 @@ void EmuThread::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OpenGLWindow::OpenGLWindow(QWindow* parent, QWidget* event_handler, QOpenGLContext* shared_context)
|
OpenGLWindow::OpenGLWindow(QWindow* parent, QWidget* event_handler, QOpenGLContext* shared_context)
|
||||||
: QWindow(parent), context(new QOpenGLContext(shared_context->parent())),
|
: QWindow(parent), context(std::make_unique<QOpenGLContext>(shared_context->parent())),
|
||||||
event_handler(event_handler) {
|
event_handler(event_handler) {
|
||||||
|
|
||||||
// disable vsync for any shared contexts
|
// disable vsync for any shared contexts
|
||||||
@ -447,8 +447,8 @@ std::unique_ptr<Frontend::GraphicsContext> GRenderWindow::CreateSharedContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLContext::GLContext(QOpenGLContext* shared_context)
|
GLContext::GLContext(QOpenGLContext* shared_context)
|
||||||
: context(new QOpenGLContext(shared_context->parent())),
|
: context(std::make_unique<QOpenGLContext>(shared_context->parent())),
|
||||||
surface(new QOffscreenSurface(nullptr)) {
|
surface(std::make_unique<QOffscreenSurface>(nullptr)) {
|
||||||
|
|
||||||
// disable vsync for any shared contexts
|
// disable vsync for any shared contexts
|
||||||
auto format = shared_context->format();
|
auto format = shared_context->format();
|
||||||
@ -463,7 +463,7 @@ GLContext::GLContext(QOpenGLContext* shared_context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GLContext::MakeCurrent() {
|
void GLContext::MakeCurrent() {
|
||||||
context->makeCurrent(surface);
|
context->makeCurrent(surface.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLContext::DoneCurrent() {
|
void GLContext::DoneCurrent() {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@ -36,8 +37,8 @@ public:
|
|||||||
void DoneCurrent() override;
|
void DoneCurrent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QOpenGLContext* context;
|
std::unique_ptr<QOpenGLContext> context;
|
||||||
QOffscreenSurface* surface;
|
std::unique_ptr<QOffscreenSurface> surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EmuThread final : public QThread {
|
class EmuThread final : public QThread {
|
||||||
@ -138,7 +139,7 @@ protected:
|
|||||||
void exposeEvent(QExposeEvent* event) override;
|
void exposeEvent(QExposeEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QOpenGLContext* context;
|
std::unique_ptr<QOpenGLContext> context;
|
||||||
QWidget* event_handler;
|
QWidget* event_handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user