From 66db9ec7d6a9f869dc922ad9a9b8a5d278577bab Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 30 Apr 2008 09:14:06 +0300 Subject: Remove INITIALIZED_INPUT from mpctx->initialized_flags The input functions are never uninited except at exit. Move the uninit to player exit function and remove the flag. --- input/input.c | 3 +++ mp_core.h | 1 - mplayer.c | 22 +++++++++------------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/input/input.c b/input/input.c index 8f5951613a..3d898aa0af 100644 --- a/input/input.c +++ b/input/input.c @@ -1770,6 +1770,9 @@ struct input_ctx *mp_input_init(int use_gui) void mp_input_uninit(struct input_ctx *ictx) { + if (!ictx) + return; + unsigned int i; mp_cmd_bind_section_t* bind_section; diff --git a/mp_core.h b/mp_core.h index dacd12c2de..d3ff5c0785 100644 --- a/mp_core.h +++ b/mp_core.h @@ -13,7 +13,6 @@ #define INITIALIZED_GETCH2 8 #define INITIALIZED_SPUDEC 32 #define INITIALIZED_STREAM 64 -#define INITIALIZED_INPUT 128 #define INITIALIZED_VOBSUB 256 #define INITIALIZED_DEMUXER 512 #define INITIALIZED_ACODEC 1024 diff --git a/mplayer.c b/mplayer.c index ccf93867b7..ba8b4485da 100644 --- a/mplayer.c +++ b/mplayer.c @@ -644,16 +644,6 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask){ } #endif - if(mask&INITIALIZED_INPUT){ - mpctx->initialized_flags&=~INITIALIZED_INPUT; - current_module="uninit_input"; - mp_input_uninit(mpctx->input); -#ifdef HAVE_MENU - if (use_menu) - menu_uninit(); -#endif - } - current_module=NULL; } @@ -668,6 +658,13 @@ void exit_player_with_rc(struct MPContext *mpctx, const char* how, int rc){ vo_uninit(mpctx->x11_state); // Close the X11 connection (if any is open). #endif + current_module="uninit_input"; + mp_input_uninit(mpctx->input); +#ifdef HAVE_MENU + if (use_menu) + menu_uninit(); +#endif + #ifdef HAVE_FREETYPE current_module="uninit_font"; if (sub_font && sub_font != vo_font) free_font_desc(sub_font); @@ -2904,7 +2901,6 @@ stream_set_interrupt_callback(mp_input_check_interrupt, mpctx->input); } #endif -mpctx->initialized_flags|=INITIALIZED_INPUT; current_module = NULL; /// Catch signals @@ -3944,7 +3940,7 @@ mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d \n",mpctx->eof); if(mpctx->dvbin_reopen) { mpctx->eof = 0; - uninit_player(mpctx, INITIALIZED_ALL-(INITIALIZED_GUI|INITIALIZED_STREAM|INITIALIZED_INPUT|INITIALIZED_GETCH2|(opts->fixed_vo?INITIALIZED_VO:0))); + uninit_player(mpctx, INITIALIZED_ALL-(INITIALIZED_GUI|INITIALIZED_STREAM|INITIALIZED_GETCH2|(opts->fixed_vo?INITIALIZED_VO:0))); cache_uninit(mpctx->stream); mpctx->dvbin_reopen = 0; goto goto_enable_cache; @@ -3982,7 +3978,7 @@ if(benchmark){ } // time to uninit all, except global stuff: -uninit_player(mpctx, INITIALIZED_ALL-(INITIALIZED_GUI+INITIALIZED_INPUT+(opts->fixed_vo?INITIALIZED_VO:0))); +uninit_player(mpctx, INITIALIZED_ALL-(INITIALIZED_GUI+(opts->fixed_vo?INITIALIZED_VO:0))); if(mpctx->set_of_sub_size > 0) { current_module="sub_free"; -- cgit v1.2.3