From 6df2ca6ea6d6e8f9ceda72e00991a0331ccdbc5d Mon Sep 17 00:00:00 2001 From: arpi Date: Wed, 29 Jan 2003 23:28:55 +0000 Subject: hopefully better uninit check git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9171 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_vesa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libvo/vo_vesa.c') diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c index 46b6860658..ef69afbcd7 100644 --- a/libvo/vo_vesa.c +++ b/libvo/vo_vesa.c @@ -98,7 +98,7 @@ static uint32_t dstBpp,dstW, dstH,dstFourcc; /* destinition image description */ static SwsContext * sws = NULL; static int32_t x_offset,y_offset; /* to center image on screen */ -static unsigned init_mode; /* mode before run of mplayer */ +static unsigned init_mode=0; /* mode before run of mplayer */ static void *init_state = NULL; /* state before run of mplayer */ static struct win_frame win; /* real-mode window to video memory */ static uint8_t *dga_buffer = NULL; /* for yuv2rgb and sw_scaling */ @@ -154,12 +154,15 @@ static void vesa_term( void ) #ifdef CONFIG_VIDIX else if(vidix_name) vidix_term(); #endif - if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err); - if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err); + if(init_state) if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err); + init_state=NULL; + if(init_mode) if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err); + init_mode=0; if(HAS_DGA()) vbeUnmapVideoBuffer((unsigned long)win.ptr,win.high); if(dga_buffer && !HAS_DGA()) free(dga_buffer); vbeDestroy(); if(sws) freeSwsContext(sws); + sws=NULL; } #define VALID_WIN_FRAME(offset) (offset >= win.low && offset < win.high) @@ -993,7 +996,6 @@ static void uninit(void) { // not inited - if (!init_state) return; vesa_term(); if(verbose > 2) printf("vo_vesa: uninit was called\n"); -- cgit v1.2.3