From patchwork Tue Nov 23 09:01:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31553 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp8354210iob; Tue, 23 Nov 2021 01:06:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxskDJHKiTvhxf6lsjs6MC2rz3QwwL48KqNa92qsEiuCaJf5SCPoV/D+SypFpj6TCtp8MBy X-Received: by 2002:a05:6402:4404:: with SMTP id y4mr6647017eda.321.1637658381539; Tue, 23 Nov 2021 01:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637658381; cv=none; d=google.com; s=arc-20160816; b=UABl0OGXULco63VlzsqScbCgf8NC+uC+gQBKqtHrr0iG8ZV+NQTi2KS476wfIIjPBy Vege+MSz04eCVNMJYHFeEGKOxtmWeTh8ra2Z8HPB60pbOhX1k92a6JKpbsTtLsVnDalT wDOeVtbzN3F7/nbjy71o4sCzPdZQ3EFi8dY+ouvELSteqsYVxQIPMqOAWdGz7E8z7ru2 n4/Fam9NoNlRhb37UDMyAN2UCnHUZ1AMKGoHMGVGisOFwJWvgzeV/4bhrHp/hz+Qh5HH tSQtrPKcNp01+S0qK003JeXr50NrFRhy1tfMGD9Yw7wbyiKnjD/uZEb7Tt18zheaCP89 NyFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=ePkngWxoPWp9VVSaBCGCvdp9GlpovrjD0fLD88TjdLs=; b=gxFns+tEXg0jtrB0oxyYojJTwwcEpCcgzfZ/RTCYzL9ZQr86S3gKqMoz8PZOKqJU0S C5ge0hOJEnoUV+7cz3Sovr3hL+R0Wy8HwENOOxn9Fkg/GGPFTXK/NXQE6LClaNXpSajQ caGI183SzT9SLTX78C9o2ypZZYDnF820VH13yXEe1ju4qMSI7jGN+heLSqqbcYqe0hxU VSP/n6qgdsGNMhZghhOGRta3m+tVORWc7BGeNg5725iWLEGfQMaSHDrHqS6M6pQomo69 UGVkD+6WymoA5hsrSGi+wQK3uprdw0ahKIOx72GSk2DJXWD4gayLPoOZGjZ/qLR2iv/D yRBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qw32si41665257ejc.13.2021.11.23.01.06.20; Tue, 23 Nov 2021 01:06:21 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3040468AE99; Tue, 23 Nov 2021 11:06:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9FB1E687F25 for ; Tue, 23 Nov 2021 11:06:00 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10176"; a="221866471" X-IronPort-AV: E=Sophos;i="5.87,257,1631602800"; d="scan'208";a="221866471" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2021 01:05:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,257,1631602800"; d="scan'208";a="509337676" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga008.jf.intel.com with ESMTP; 23 Nov 2021 01:05:46 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Nov 2021 17:01:17 +0800 Message-Id: <20211123090119.868788-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123090119.868788-1-jianhua.wu@intel.com> References: <20211123090119.868788-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] avutil/hwcontext_vulkan: check if created before destroying the device X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Tm0cgkRvsjbM Signed-off-by: Wu Jianhua --- libavutil/hwcontext_vulkan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index f1e750cd3e..4ac1058181 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1150,7 +1150,8 @@ static void vulkan_device_free(AVHWDeviceContext *ctx) FFVulkanFunctions *vk = &p->vkfn; AVVulkanDeviceContext *hwctx = ctx->hwctx; - vk->DestroyDevice(hwctx->act_dev, hwctx->alloc); + if (hwctx->act_dev) + vk->DestroyDevice(hwctx->act_dev, hwctx->alloc); if (p->debug_ctx) vk->DestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx,