From 08443e5e4d7749ca1dfd22ff10ce492d98b1a792 Mon Sep 17 00:00:00 2001 From: megai2 Date: Tue, 11 Aug 2020 20:16:57 +0300 Subject: [PATCH] properly remove thread refs from occlusion queries fixes infinite loop on exit related to #276 --- d912pxy/d912pxy_query_occlusion.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/d912pxy/d912pxy_query_occlusion.cpp b/d912pxy/d912pxy_query_occlusion.cpp index bb18a438..8dd9c9ed 100644 --- a/d912pxy/d912pxy_query_occlusion.cpp +++ b/d912pxy/d912pxy_query_occlusion.cpp @@ -233,6 +233,16 @@ void d912pxy_query_occlusion::FreePendingQueryObjects() void d912pxy_query_occlusion::DeInitOccQueryEmulation() { + //finish outstanding queres so thery are properly freed on exit + d912pxy_query_occlusion_gpu_stack* readStack = &g_gpuStack[!g_writeStack]; + if (readStack->count) + { + for (int i = 0; i != readStack->count; ++i) + readStack->stack[i]->SetQueryResult(0); + + readStack->count = 0; + } + if (!g_occQueryHeap) return;