changeset 2102:e0281dae2cb8

Backed out changeset dcca36701cdd
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 07 Mar 2019 14:12:21 +0200
parents da886b8cbb09
children 78a9140f02b1
files tools/64vw.c tools/ppl.c
diffstat 2 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/64vw.c	Wed Mar 06 10:00:03 2019 +0200
+++ b/tools/64vw.c	Thu Mar 07 14:12:21 2019 +0200
@@ -546,10 +546,17 @@
     // Cleanup
     dmFree(optFilenames);
 
-    SDL_DestroyTexture(texture);
-    SDL_DestroyRenderer(renderer);
-    SDL_DestroyWindow(window);
-    SDL_FreeSurface(surf);
+    if (texture != NULL)
+        SDL_DestroyTexture(texture);
+
+    if (renderer != NULL)
+        SDL_DestroyRenderer(renderer);
+
+    if (window != NULL)
+        SDL_DestroyWindow(window);
+
+    if (surf != NULL)
+        SDL_FreeSurface(surf);
 
     if (initSDL)
         SDL_Quit();
--- a/tools/ppl.c	Wed Mar 06 10:00:03 2019 +0200
+++ b/tools/ppl.c	Thu Mar 07 14:12:21 2019 +0200
@@ -527,7 +527,8 @@
 
 void dmMuteChannels(BOOL mute)
 {
-    for (int i = 0; i < eng.mod->nchannels; i++)
+    int i;
+    for (i = 0; i < eng.mod->nchannels; i++)
         jvmMute(eng.dev, i, mute);
 }
 
@@ -920,10 +921,17 @@
     }
 
 error_exit:
-    SDL_DestroyTexture(eng.texture);
-    SDL_DestroyRenderer(eng.renderer);
-    SDL_DestroyWindow(eng.window);
-    SDL_FreeSurface(eng.screen);
+    if (eng.texture != NULL)
+        SDL_DestroyTexture(eng.texture);
+
+    if (eng.renderer != NULL)
+        SDL_DestroyRenderer(eng.renderer);
+
+    if (eng.window != NULL)
+        SDL_DestroyWindow(eng.window);
+
+    if (eng.screen != NULL)
+        SDL_FreeSurface(eng.screen);
 
     dmMsg(0, "Audio shutdown.\n");
     if (audioInit)