From 046fe459505c59fe151661d6214fe25e2414423b Mon Sep 17 00:00:00 2001 From: Ryo Munakata Date: Sun, 29 Oct 2017 00:33:50 +0900 Subject: hwdec_drmprime_drm: fix segv with --hwdec --- video/out/opengl/hwdec_drmprime_drm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c index d942ab3d37..45e6c908c0 100644 --- a/video/out/opengl/hwdec_drmprime_drm.c +++ b/video/out/opengl/hwdec_drmprime_drm.c @@ -67,7 +67,10 @@ static void set_current_frame(struct ra_hwdec *hw, struct drm_frame *frame) // We used old frame as triple buffering to make sure that the drm framebuffer // is not being displayed when we release it. - drm_prime_destroy_framebuffer(p->log, p->ctx->fd, &p->old_frame.fb); + if (p->ctx) { + drm_prime_destroy_framebuffer(p->log, p->ctx->fd, &p->old_frame.fb); + } + mp_image_setrefp(&p->old_frame.image, p->current_frame.image); p->old_frame.fb = p->current_frame.fb; -- cgit v1.2.3