From 8b098c0c040147d98db10ed6e1e817ac2d39e377 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 24 Apr 2016 00:31:00 +0200 Subject: [PATCH] Fix a context memory leak on cut. --- context.cpp | 5 +++++ context.h | 1 + quicksync_encoder.cpp | 1 + 3 files changed, 7 insertions(+) diff --git a/context.cpp b/context.cpp index 6ce5744..ea576cd 100644 --- a/context.cpp +++ b/context.cpp @@ -35,3 +35,8 @@ bool make_current(QOpenGLContext *context, QSurface *surface) { return context->makeCurrent(surface); } + +void delete_context(QOpenGLContext *context) +{ + delete context; +} diff --git a/context.h b/context.h index 0c92a60..aeda12b 100644 --- a/context.h +++ b/context.h @@ -11,3 +11,4 @@ extern QGLWidget *global_share_widget; QSurface *create_surface(const QSurfaceFormat &format); QOpenGLContext *create_context(const QSurface *surface); bool make_current(QOpenGLContext *context, QSurface *surface); +void delete_context(QOpenGLContext *context); diff --git a/quicksync_encoder.cpp b/quicksync_encoder.cpp index 41ace54..fa00a34 100644 --- a/quicksync_encoder.cpp +++ b/quicksync_encoder.cpp @@ -1774,6 +1774,7 @@ QuickSyncEncoderImpl::QuickSyncEncoderImpl(const std::string &filename, QSurface exit(1); } encode_thread_func(); + delete_context(context); }); } -- 2.39.2