From 961332309c058d595390f780fd7ae88b7176bc4a Mon Sep 17 00:00:00 2001 From: jojo61 Date: Thu, 11 Oct 2018 19:47:38 +0200 Subject: [PATCH] again fixed crash with start recording --- video.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/video.c b/video.c index 96aa8eb..875b03b 100644 --- a/video.c +++ b/video.c @@ -1764,12 +1764,13 @@ static void CuvidDestroySurfaces(CuvidDecoder * decoder) glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext); GlxCheck(); - - for (i=0;iSurfacesNeeded;i++) { - for (j=0;j<2;j++) { - if (decoder->cu_res[i][j]) { - checkCudaErrors(cuGraphicsUnregisterResource(decoder->cu_res[i][j])); - decoder->cu_res[i][j] = 0; + if (decoder->cuda_ctx) { + for (i=0;iSurfacesNeeded;i++) { + for (j=0;j<2;j++) { + if (decoder->cu_res[i][j]) { + checkCudaErrors(cuGraphicsUnregisterResource(decoder->cu_res[i][j])); + decoder->cu_res[i][j] = 0; + } } } }