Commit cf8441a2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: make sure the interface doesn't leak any inputs. fixes crashes on quit...

macosx: make sure the interface doesn't leak any inputs. fixes crashes on quit after adding a file to the playlist
parent 3d493727
...@@ -233,13 +233,22 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -233,13 +233,22 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if (!p_input) return nil; if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input ); 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 ); 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; NSURL *o_url;
o_url = [NSURL URLWithString:[NSString stringWithUTF8String:psz_uri]]; o_url = [NSURL URLWithString:[NSString stringWithUTF8String:psz_uri]];
vlc_object_release( p_input );
return o_url; return o_url;
} }
...@@ -250,10 +259,18 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -250,10 +259,18 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if (!p_input) return nil; if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input ); 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 ); 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; NSString *o_name;
char *format = var_InheritString( VLCIntf, "input-title-format" ); char *format = var_InheritString( VLCIntf, "input-title-format" );
...@@ -272,6 +289,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -272,6 +289,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
else else
o_name = [o_url absoluteString]; o_name = [o_url absoluteString];
} }
vlc_object_release( p_input );
return o_name; return o_name;
} }
......
...@@ -1042,6 +1042,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1042,6 +1042,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setTitle: aString]; [self setTitle: aString];
[o_fspanel setStreamTitle: aString]; [o_fspanel setStreamTitle: aString];
vlc_object_release( p_input );
} }
else else
{ {
......
...@@ -218,7 +218,11 @@ ...@@ -218,7 +218,11 @@
if( !p_input ) return; if( !p_input ) return;
input_item_t *p_item = input_GetItem( p_input ); 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 ); char *path = input_item_GetURI( p_item );
if( !path ) path = strdup( "" ); if( !path ) path = strdup( "" );
...@@ -247,6 +251,7 @@ ...@@ -247,6 +251,7 @@
[[[[openPanel URLs] objectAtIndex: i] path] UTF8String] ); [[[[openPanel URLs] objectAtIndex: i] path] UTF8String] );
} }
} }
vlc_object_release( p_input );
} }
- (void)scrollWheel:(NSEvent *)theEvent - (void)scrollWheel:(NSEvent *)theEvent
......
...@@ -727,6 +727,13 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -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-toggle-fscontrol", ShowController, self);
var_DelCallback(p_intf->p_libvlc, "intf-show", 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 */ /* remove global observer watching for vout device changes correctly */
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
...@@ -1352,8 +1359,9 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1352,8 +1359,9 @@ unsigned int CocoaKeyToVLC( unichar i_key )
if( p_input != NULL && [self activeVideoPlayback] ) if( p_input != NULL && [self activeVideoPlayback] )
{ {
[o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO]; [o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
vlc_object_release( p_input );
} }
if (p_input)
vlc_object_release( p_input );
} }
else else
{ {
...@@ -1372,11 +1380,13 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1372,11 +1380,13 @@ unsigned int CocoaKeyToVLC( unichar i_key )
{ {
var_AddCallback( p_input, "intf-event", InputEvent, [VLCMain sharedInstance] ); var_AddCallback( p_input, "intf-event", InputEvent, [VLCMain sharedInstance] );
[o_mainmenu setRateControlsEnabled: YES]; [o_mainmenu setRateControlsEnabled: YES];
vlc_object_release( p_input );
} }
else else
[o_mainmenu setRateControlsEnabled: NO]; [o_mainmenu setRateControlsEnabled: NO];
if (p_input)
vlc_object_release( p_input );
[o_playlist updateRowSelection]; [o_playlist updateRowSelection];
[o_mainwindow updateWindow]; [o_mainwindow updateWindow];
[self updateMainMenu]; [self updateMainMenu];
......
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