[vlc-commits] macosx: make sure the interface doesn't leak any inputs. fixes crashes on quit after adding a file to the playlist
Felix Paul Kühne
git at videolan.org
Wed Feb 15 15:37:18 CET 2012
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Feb 15 15:37:12 2012 +0100| [cf8441a23c17e1f17feedfd8681f0d846cb7d19b] | committer: Felix Paul Kühne
macosx: make sure the interface doesn't leak any inputs. fixes crashes on quit after adding a file to the playlist
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cf8441a23c17e1f17feedfd8681f0d846cb7d19b
---
modules/gui/macosx/CoreInteraction.m | 26 ++++++++++++++++++++++----
modules/gui/macosx/MainWindow.m | 1 +
modules/gui/macosx/controls.m | 7 ++++++-
modules/gui/macosx/intf.m | 14 ++++++++++++--
4 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index 2044c42..d552f79 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -233,13 +233,22 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input );
- if (!p_item) return nil;
+ if (!p_item)
+ {
+ vlc_object_release( p_input );
+ return nil;
+ }
char *psz_uri = input_item_GetURI( p_item );
- if (!psz_uri) return nil;
+ if (!psz_uri)
+ {
+ vlc_object_release( p_input );
+ return nil;
+ }
NSURL *o_url;
o_url = [NSURL URLWithString:[NSString stringWithUTF8String:psz_uri]];
+ vlc_object_release( p_input );
return o_url;
}
@@ -250,10 +259,18 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input );
- if (!p_item) return nil;
+ if (!p_item)
+ {
+ vlc_object_release( p_input );
+ return nil;
+ }
char *psz_uri = input_item_GetURI( p_item );
- if (!psz_uri) return nil;
+ if (!psz_uri)
+ {
+ vlc_object_release( p_input );
+ return nil;
+ }
NSString *o_name;
char *format = var_InheritString( VLCIntf, "input-title-format" );
@@ -272,6 +289,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
else
o_name = [o_url absoluteString];
}
+ vlc_object_release( p_input );
return o_name;
}
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 5c9e4d2..e818b00 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1042,6 +1042,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setTitle: aString];
[o_fspanel setStreamTitle: aString];
+ vlc_object_release( p_input );
}
else
{
diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
index bf40882..5e1517d 100644
--- a/modules/gui/macosx/controls.m
+++ b/modules/gui/macosx/controls.m
@@ -218,7 +218,11 @@
if( !p_input ) return;
input_item_t *p_item = input_GetItem( p_input );
- if( !p_item ) return;
+ if( !p_item )
+ {
+ vlc_object_release( p_input );
+ return;
+ }
char *path = input_item_GetURI( p_item );
if( !path ) path = strdup( "" );
@@ -247,6 +251,7 @@
[[[[openPanel URLs] objectAtIndex: i] path] UTF8String] );
}
}
+ vlc_object_release( p_input );
}
- (void)scrollWheel:(NSEvent *)theEvent
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index b0eba89..77f21c6 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -727,6 +727,13 @@ static VLCMain *_o_sharedMainInstance = nil;
var_DelCallback(p_intf->p_libvlc, "intf-toggle-fscontrol", ShowController, self);
var_DelCallback(p_intf->p_libvlc, "intf-show", ShowController, self);
+ input_thread_t * p_input = playlist_CurrentInput( p_playlist );
+ if( p_input )
+ {
+ var_DelCallback( p_input, "intf-event", InputEvent, [VLCMain sharedInstance] );
+ vlc_object_release( p_input );
+ }
+
/* remove global observer watching for vout device changes correctly */
[[NSNotificationCenter defaultCenter] removeObserver: self];
@@ -1352,8 +1359,9 @@ unsigned int CocoaKeyToVLC( unichar i_key )
if( p_input != NULL && [self activeVideoPlayback] )
{
[o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
- vlc_object_release( p_input );
}
+ if (p_input)
+ vlc_object_release( p_input );
}
else
{
@@ -1372,11 +1380,13 @@ unsigned int CocoaKeyToVLC( unichar i_key )
{
var_AddCallback( p_input, "intf-event", InputEvent, [VLCMain sharedInstance] );
[o_mainmenu setRateControlsEnabled: YES];
- vlc_object_release( p_input );
}
else
[o_mainmenu setRateControlsEnabled: NO];
+ if (p_input)
+ vlc_object_release( p_input );
+
[o_playlist updateRowSelection];
[o_mainwindow updateWindow];
[self updateMainMenu];
More information about the vlc-commits
mailing list