From d49e641a29b050a1caf9f54f991034efa4dbb0e2 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Tue, 19 May 2020 18:52:55 +0000 Subject: [PATCH] Reset r_shadow_occlusion_buf on vid_restart. Fixes query buffer dangling pointer Basically, when coronas appear when r_coronas_occlusionquery is 1, the engine binds to a query buffer and stores a pointer to it in r_shadow_occlusion_buf. Upon vid_restart, somewhere along the way, the buffer is cleared but the original pointer is kept, resulting in a crash next time a corona appears. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12541 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gl_rmain.c b/gl_rmain.c index 2897c78f..5d5f29c4 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3085,6 +3085,8 @@ static void gl_main_start(void) #endif } +extern unsigned int r_shadow_occlusion_buf; + static void gl_main_shutdown(void) { R_RenderTarget_FreeUnused(true); @@ -3105,7 +3107,7 @@ static void gl_main_shutdown(void) #endif break; } - + r_shadow_occlusion_buf = 0; r_numqueries = 0; r_maxqueries = 0; memset(r_queries, 0, sizeof(r_queries)); -- 2.39.2