Commit 98f134c2 authored by Rémi Duraffort's avatar Rémi Duraffort

video_filter: fix a potential crash (callback called when

p_sys members are destroyed).
parent c73675ef
......@@ -133,11 +133,14 @@ static void Destroy( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
var_DelCallback( p_filter, CFG_PREFIX "mask", MaskCallback,
p_filter );
vlc_mutex_destroy( &p_sys->mask_lock );
if( p_filter->p_sys->p_mask )
picture_Release( p_filter->p_sys->p_mask );
if( p_sys->p_mask )
picture_Release( p_sys->p_mask );
free( p_filter->p_sys );
free( p_sys );
}
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
......
......@@ -140,6 +140,7 @@ static int Create( vlc_object_t *p_this )
GET_VAR( ut, 0x00, 0xff );
GET_VAR( vt, 0x00, 0xff );
p_sys->p_at = NULL;
#undef GET_VAR
p_filter->pf_video_filter = Filter;
......@@ -149,9 +150,15 @@ static int Create( vlc_object_t *p_this )
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
var_DelCallback( p_filter, CFG_PREFIX "u", BluescreenCallback, p_sys );
var_DelCallback( p_filter, CFG_PREFIX "v", BluescreenCallback, p_sys );
var_DelCallback( p_filter, CFG_PREFIX "ut", BluescreenCallback, p_sys );
var_DelCallback( p_filter, CFG_PREFIX "vt", BluescreenCallback, p_sys );
free( p_filter->p_sys->p_at );
free( p_filter->p_sys );
free( p_sys->p_at );
free( p_sys );
}
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
......
......@@ -157,6 +157,10 @@ static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
var_DelCallback( p_filter, FILTER_PREFIX "angle", RotateCallback, p_filter->p_sys );
var_DelCallback( p_filter, FILTER_PREFIX "deciangle",
PreciseRotateCallback, p_filter->p_sys );
free( p_filter->p_sys );
}
......
......@@ -147,6 +147,8 @@ static int Create( vlc_object_t *p_this )
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
var_DelCallback( p_filter, FILTER_PREFIX "sigma",
SharpenCallback, p_filter->p_sys );
free( p_filter->p_sys );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment