Commit 6951818d 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
(cherry picked from commit cf8441a2)
parent 6bbadce7
......@@ -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;
}
......
......@@ -1042,6 +1042,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setTitle: aString];
[o_fspanel setStreamTitle: aString];
vlc_object_release( p_input );
}
else
{
......
......@@ -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
......
......@@ -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];
......
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