foxygit / doom Log in
commit 05c3023d2b891c2d4361822b439c59e5828eee79
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Fri Dec 21 13:14:56 2018 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Fri Dec 21 13:14:56 2018 +0100

    video: point destroyed textures to NULL

    When a renderer gets destroyed, all associated textures get destroyed
    as well, so point them to NULL to prevent them being destroyed again.
---
 src/i_video.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/i_video.c b/src/i_video.c
index bcf8c21b..9070896d 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1239,6 +1239,9 @@ static void SetVideoMode(void)
     if (renderer != NULL)
     {
         SDL_DestroyRenderer(renderer);
+        // all associated textures get destroyed
+        texture = NULL;
+        texture_upscaled = NULL;
     }

     renderer = SDL_CreateRenderer(screen, -1, renderer_flags);