[vlc-devel] commit: macosx: Make sure the manageIntf: Timer is getting cancelled at exit. (Pierre d'Herbemont )
git version control
git at videolan.org
Sat Jul 5 02:15:35 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Jul 5 02:14:17 2008 +0200| [a409380da011ba3fb820b7d2265171239e3b8851]
macosx: Make sure the manageIntf: Timer is getting cancelled at exit.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a409380da011ba3fb820b7d2265171239e3b8851
---
modules/gui/macosx/intf.h | 3 +++
modules/gui/macosx/intf.m | 15 +++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index 4b54105..7ec3957 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -307,6 +307,9 @@ struct intf_sys_t
/* the manage thread */
pthread_t manage_thread;
+ /* The timer that update the interface */
+ NSTimer * interfaceTimer;
+
AppleRemote * o_remote;
BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
}
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 47387cb..9502456 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -778,9 +778,9 @@ static VLCMain *_o_sharedMainInstance = nil;
forMode: NSDefaultRunLoopMode];
/* FIXME: don't poll */
- [NSTimer scheduledTimerWithTimeInterval: 0.5
+ interfaceTimer = [[NSTimer scheduledTimerWithTimeInterval: 0.5
target: self selector: @selector(manageIntf:)
- userInfo: nil repeats: FALSE];
+ userInfo: nil repeats: FALSE] retain];
/* Note: we use the pthread API to support pre-10.5 */
pthread_create( &manage_thread, NULL, ManageThread, self );
@@ -1443,9 +1443,11 @@ static VLCMain *_o_sharedMainInstance = nil;
if( ((i_end_scroll != -1) && (mdate() > i_end_scroll)) || !p_input )
[self resetScrollField];
- [NSTimer scheduledTimerWithTimeInterval: 0.3
+ [interfaceTimer autorelease];
+
+ interfaceTimer = [[NSTimer scheduledTimerWithTimeInterval: 0.3
target: self selector: @selector(manageIntf:)
- userInfo: nil repeats: FALSE];
+ userInfo: nil repeats: FALSE] retain];
}
- (void)setupMenus
@@ -1765,6 +1767,11 @@ static VLCMain *_o_sharedMainInstance = nil;
/* Make sure our manage_thread ends */
pthread_join( manage_thread, NULL );
+ /* Make sure the interfaceTimer is destroyed */
+ [interfaceTimer invalidate];
+ [interfaceTimer release];
+ interfaceTimer = nil;
+
/* make sure that the current volume is saved */
config_PutInt( p_intf->p_libvlc, "volume", i_lastShownVolume );
returnedValue = config_SaveConfigFile( p_intf->p_libvlc, "main" );
More information about the vlc-devel
mailing list