[Bf-blender-cvs] [3fd766b] temp_viewport_fx_merge: Exit without leaks and crashes.

Antony Riakiotakis noreply at git.blender.org
Wed Apr 1 14:31:03 CEST 2015


Commit: 3fd766ba383a436193427624454a60771cee5173
Author: Antony Riakiotakis
Date:   Wed Apr 1 14:30:57 2015 +0200
Branches: temp_viewport_fx_merge
https://developer.blender.org/rB3fd766ba383a436193427624454a60771cee5173

Exit without leaks and crashes.

===================================================================

M	source/blender/gpu/intern/gpu_font.c
M	source/blender/gpu/intern/gpu_init_exit.c
M	source/blender/gpu/intern/gpu_pixels.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_font.c b/source/blender/gpu/intern/gpu_font.c
index 01b76dc..0948ae0 100644
--- a/source/blender/gpu/intern/gpu_font.c
+++ b/source/blender/gpu/intern/gpu_font.c
@@ -62,7 +62,8 @@ void gpu_font_init(void)
 
 void gpu_font_exit(void)
 {
-	GPU_shader_free(FONT_SHADER);
+	if (FONT_SHADER)
+		GPU_shader_free(FONT_SHADER);
 
 #ifdef GPU_SAFETY
 	FONT_BEGUN = false;
diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c
index 884a2d1..de9bc0b 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -88,10 +88,32 @@ void GPU_init(void)
 
 void GPU_exit(void)
 {
+	BLI_assert(initialized);
 	GPU_DEBUG_EXIT();
 
+	GPU_aspect_end();
+
+	gpuDeleteIndex(gpu_index);
+	gpuImmediateIndex(NULL);
+
+	gpuImmediateMakeCurrent(NULL);
+	gpuDeleteImmediate(gpu_immediate);
+
+	gpu_state_latch_exit();
+	gpu_sprite_exit();
+	gpu_select_exit();
+	gpu_raster_exit();
+	gpu_pixels_exit();
 	gpu_matrix_exit();
+	gpu_lighting_exit();
+	gpu_immediate_exit();
+	gpu_font_exit();
+	gpu_common_exit();
 	gpu_codegen_exit();
+	gpu_clipping_exit();
+	gpu_blender_aspect_exit();
+	gpu_basic_exit();
+	gpu_aspect_exit();
 
 	gpu_extensions_exit(); /* must come last */
 
diff --git a/source/blender/gpu/intern/gpu_pixels.c b/source/blender/gpu/intern/gpu_pixels.c
index 44051e0..fcadc24 100644
--- a/source/blender/gpu/intern/gpu_pixels.c
+++ b/source/blender/gpu/intern/gpu_pixels.c
@@ -62,7 +62,8 @@ void gpu_pixels_init(void)
 
 void gpu_pixels_exit(void)
 {
-	GPU_shader_free(PIXELS_SHADER);
+	if (PIXELS_SHADER)
+		GPU_shader_free(PIXELS_SHADER);
 }
 
 void GPU_bitmap_cache(GPUbitmap *bitmap)




More information about the Bf-blender-cvs mailing list