[vlc-devel] commit: update: Make sure we don't leak. (Pierre d'Herbemont )

git version control git at videolan.org
Tue Sep 2 01:31:10 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Tue Sep  2 01:31:02 2008 +0200| [dfa0e1e9539a053a12073c333bd28e6d21ecd80a] | committer: Pierre d'Herbemont 

update: Make sure we don't leak.

This fix also a crash because of a non joined thread on Mac OS X.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dfa0e1e9539a053a12073c333bd28e6d21ecd80a
---

 modules/gui/macosx/intf.m   |    2 ++
 modules/gui/macosx/update.h |    2 ++
 modules/gui/macosx/update.m |    5 +++++
 src/misc/update.c           |    1 +
 4 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 015cd16..9782a19 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -672,6 +672,8 @@ static VLCMain *_o_sharedMainInstance = nil;
     /* remove global observer watching for vout device changes correctly */
     [[NSNotificationCenter defaultCenter] removeObserver: self];
 
+    [o_update end];
+
     /* release some other objects here, because it isn't sure whether dealloc
      * will be called later on */
 
diff --git a/modules/gui/macosx/update.h b/modules/gui/macosx/update.h
index 93500fc..0db8b0d 100644
--- a/modules/gui/macosx/update.h
+++ b/modules/gui/macosx/update.h
@@ -47,6 +47,8 @@
     bool b_checked;
 }
 
+- (void)end;
+
 - (IBAction)download:(id)sender;
 - (IBAction)okay:(id)sender;
 - (IBAction)changeCheckUpdateOnStartup:(id)sender;
diff --git a/modules/gui/macosx/update.m b/modules/gui/macosx/update.m
index 88ed6bd..f8c71ae 100644
--- a/modules/gui/macosx/update.m
+++ b/modules/gui/macosx/update.m
@@ -69,6 +69,11 @@ static VLCUpdate *_o_sharedInstance = nil;
     return _o_sharedInstance;
 }
 
+- (void)end
+{
+    if( p_u ) update_Delete( p_u );
+}
+
 - (void)awakeFromNib
 {
     /* we don't use - (BOOL)shouldCheckUpdateOnStartup because we don't want
diff --git a/src/misc/update.c b/src/misc/update.c
index d3ca5d2..7e7913a 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -1074,6 +1074,7 @@ void update_Delete( update_t *p_update )
         assert( !p_update->p_download );
         vlc_object_kill( p_update->p_check );
         vlc_thread_join( p_update->p_check );
+        vlc_object_release( p_update->p_check );
     }
     else if( p_update->p_download )
     {




More information about the vlc-devel mailing list