diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 0fb1722cba..2624203627 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1171,7 +1171,7 @@ static void d3d_free(void *data) d3d_free_overlays(d3d); #endif - gfx_ctx_free(); + gfx_ctx_ctl(GFX_CTL_FREE, NULL); #ifndef _XBOX #ifdef HAVE_MENU diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index a032ffed6e..51a212f26c 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1994,7 +1994,7 @@ static void gl_free(void *data) } #endif - gfx_ctx_free(); + gfx_ctx_ctl(GFX_CTL_FREE, NULL); free(gl->empty_buf); free(gl->conv_buffer); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index e9430d18f9..6b0c3b987a 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -220,7 +220,7 @@ static void vg_free(void *data) vgDestroyPaint(vg->mPaintBg); } - gfx_ctx_free(); + gfx_ctx_ctl(GFX_CTL_FREE, NULL); free(vg); } diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 446cace6d6..c411ef03e7 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -95,14 +95,6 @@ void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver) current_video_context = NULL; } -void gfx_ctx_free(void) -{ - if (current_video_context->destroy) - current_video_context->destroy(video_context_data); - current_video_context = NULL; - video_context_data = NULL; -} - const char *gfx_ctx_get_ident(void) { const gfx_ctx_driver_t *ctx = current_video_context; @@ -447,6 +439,12 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) { switch (state) { + case GFX_CTL_FREE: + if (current_video_context->destroy) + current_video_context->destroy(video_context_data); + current_video_context = NULL; + video_context_data = NULL; + break; case GFX_CTL_NONE: default: break; diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 0ba57707bc..98e7014480 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -53,7 +53,8 @@ enum display_metric_types enum gfx_ctx_ctl_state { - GFX_CTL_NONE = 0 + GFX_CTL_NONE = 0, + GFX_CTL_FREE }; typedef void (*gfx_ctx_proc_t)(void); @@ -248,8 +249,6 @@ bool gfx_ctx_get_video_output_next(void); const char *gfx_ctx_get_ident(void); -void gfx_ctx_free(void); - void gfx_ctx_input_driver( const input_driver_t **input, void **input_data);