[vlc-devel] commit: video_filter: fix a potential crash (callback called when ( Rémi Duraffort )
git version control
git at videolan.org
Thu Mar 26 15:38:33 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Mar 25 21:42:41 2009 +0100| [98f134c22e825fa831e66112d3969d9856d046ac] | committer: Rémi Duraffort
video_filter: fix a potential crash (callback called when
p_sys members are destroyed).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98f134c22e825fa831e66112d3969d9856d046ac
---
modules/video_filter/alphamask.c | 9 ++++++---
modules/video_filter/bluescreen.c | 11 +++++++++--
modules/video_filter/rotate.c | 4 ++++
modules/video_filter/sharpen.c | 2 ++
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/modules/video_filter/alphamask.c b/modules/video_filter/alphamask.c
index bdc6132..79999cd 100644
--- a/modules/video_filter/alphamask.c
+++ b/modules/video_filter/alphamask.c
@@ -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 )
diff --git a/modules/video_filter/bluescreen.c b/modules/video_filter/bluescreen.c
index 61f07a4..e2b4442 100644
--- a/modules/video_filter/bluescreen.c
+++ b/modules/video_filter/bluescreen.c
@@ -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 )
diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c
index 95dcbb3..8a0873e 100644
--- a/modules/video_filter/rotate.c
+++ b/modules/video_filter/rotate.c
@@ -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 );
}
diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c
index 636d687..ce7fdd9 100644
--- a/modules/video_filter/sharpen.c
+++ b/modules/video_filter/sharpen.c
@@ -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 );
}
More information about the vlc-devel
mailing list