From ad88df7e924f2be11187b15085b0764771546abe Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 19 Dec 2019 21:39:46 +0100 Subject: avoid Skia assert on leaked resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie9d9117c43d19b9391f8e0dee6825076aaa12706 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85582 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- external/skia/share-grcontext.patch.1 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'external/skia') diff --git a/external/skia/share-grcontext.patch.1 b/external/skia/share-grcontext.patch.1 index ea5952eeac1d..96a4fce322e5 100644 --- a/external/skia/share-grcontext.patch.1 +++ b/external/skia/share-grcontext.patch.1 @@ -1,5 +1,5 @@ diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp -index c2b26b4254..ef84f7902a 100644 +index c2b26b4254..e8ddbcc886 100644 --- a/tools/sk_app/VulkanWindowContext.cpp +++ b/tools/sk_app/VulkanWindowContext.cpp @@ -24,8 +24,10 @@ @@ -271,7 +271,7 @@ index c2b26b4254..ef84f7902a 100644 fBackbuffers[i].fRenderSemaphore, nullptr)); } -@@ -411,41 +429,55 @@ VulkanWindowContext::~VulkanWindowContext() { +@@ -411,41 +429,59 @@ VulkanWindowContext::~VulkanWindowContext() { void VulkanWindowContext::destroyContext() { if (this->isValid()) { fQueueWaitIdle(fPresentQueue); @@ -299,18 +299,22 @@ index c2b26b4254..ef84f7902a 100644 + + checkDestroyShared(); +} - -- if (VK_NULL_HANDLE != fDevice) { -- fDestroyDevice(fDevice, nullptr); -- fDevice = VK_NULL_HANDLE; ++ +void VulkanWindowContext::checkDestroyShared() +{ + if(!fGlobalShared || !fGlobalShared->unique()) // TODO mutex? + return; ++#ifndef SK_TRACE_VK_RESOURCES ++ if(!fGlobalShared->fContext->unique()) ++ return; ++#endif + SkASSERT(fGlobalShared->fContext->unique()); + fGlobalShared->fContext.reset(); + fGlobalShared->fInterface.reset(); -+ + +- if (VK_NULL_HANDLE != fDevice) { +- fDestroyDevice(fDevice, nullptr); +- fDevice = VK_NULL_HANDLE; + if (VK_NULL_HANDLE != fGlobalShared->fDevice) { + fGlobalShared->fDestroyDevice(fGlobalShared->fDevice, nullptr); + fGlobalShared->fDevice = VK_NULL_HANDLE; @@ -340,7 +344,7 @@ index c2b26b4254..ef84f7902a 100644 } VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer() { -@@ -471,35 +503,35 @@ sk_sp VulkanWindowContext::getBackbufferSurface() { +@@ -471,35 +507,35 @@ sk_sp VulkanWindowContext::getBackbufferSurface() { semaphoreInfo.pNext = nullptr; semaphoreInfo.flags = 0; VkSemaphore semaphore; @@ -382,7 +386,7 @@ index c2b26b4254..ef84f7902a 100644 return nullptr; } } -@@ -543,4 +575,6 @@ void VulkanWindowContext::swapBuffers() { +@@ -543,4 +579,6 @@ void VulkanWindowContext::swapBuffers() { fQueuePresentKHR(fPresentQueue, &presentInfo); } -- cgit