From patchwork Wed Nov 24 04:11:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31614 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp9779984iob; Tue, 23 Nov 2021 20:16:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1GmuXekCq6cxGn7h/r1JtYKZfxRTSEZMx4HySI/rMLWfR8sgsbzyTcNAIebIBZln08VcI X-Received: by 2002:a05:6402:100e:: with SMTP id c14mr19582560edu.196.1637727385642; Tue, 23 Nov 2021 20:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637727385; cv=none; d=google.com; s=arc-20160816; b=Ojz8dsK8dUMTkOBiHwyAVGO3wBt88NlddKvbOwBlPZ2S3FP0gP+P18pF1RBAGMQZDz ZvIFYxv/U0VmPbbbnfWJ+BU2Uu5qwjWnglW1AYtzMemvX+B0b8p9T9sxJTBPhmiOon+P hV3cxoezLH4jr9MZu9XOn7gjEqKUw7H9tCz4hhnmM90ukTu2OQSVCdMe5ltMWExtKs5m 4p3McjLU5vRjm3qP+RYMRtXHL7YDImVAnM9vdTRctEV731w3iGakR3kK3wOMbuuYMmeu 8ga8KDBvmJEB5qtEmUdKzlCojBQkzVeg7D3yyUC53f8D7PmXxyw97ugqLS6RG2kcU2/1 aYrA== 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=v1QXWyNTVBOtl1B+/+88uho4NfFl7JtxIMMvlTMQd/9MzL6BnoxE2bkWyunPW7318g ryO2x36KCM0memLuyCQJNKBx+wqnXn6/IdWgDbQ9zwDfi84uhShPvy2LR76OF+wx04ze U+f/5+wf8j1WjyN77Ed5TmBw0XZdliajVP6HIbroHQMIIuYqzW2wVBzWCWaYYKSt78jN zkQnA4xTT1PkSdQmE07z9m1m/i5BF+2OQSWlc2jqmqZ3PnSlPjJqoKVvV+K1JFF5uA+6 j5xutd1YJZfUdanoospjQM2eObvoGz29lP8+qbGLnbX4TXfJkg9ld9y5S0ZTNJ6mmjq4 fp7Q== 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 dm11si37703918ejc.54.2021.11.23.20.16.25; Tue, 23 Nov 2021 20:16:25 -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 1450368AEDE; Wed, 24 Nov 2021 06:16:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2021C688073 for ; Wed, 24 Nov 2021 06:16:04 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10177"; a="232692342" X-IronPort-AV: E=Sophos;i="5.87,258,1631602800"; d="scan'208";a="232692342" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2021 20:16:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,258,1631602800"; d="scan'208";a="509676695" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga008.jf.intel.com with ESMTP; 23 Nov 2021 20:16:01 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Nov 2021 12:11:52 +0800 Message-Id: <20211124041154.1090109-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211124041154.1090109-1-jianhua.wu@intel.com> References: <20211124041154.1090109-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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: dxcCH+b6NiOh 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,