Commit 39c71bd7 authored by David Fuhrmann's avatar David Fuhrmann

macosx: deinit VLCMain, fix retain cycles for InputManager and playlist

By deinitializing VLCMain, all connected objects are supposed to
be deallocated automatically. If [VLCMain sharedInstance] is gone,
the intf is deinitalized (this was previously checked with a
nil value of VLCIntf).

Fixes some retain cycles in input manager and playlist code which
prevented these objects to be deinitalized.
parent c500901b
......@@ -133,7 +133,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
@interface VLCInputManager()
{
VLCMain *o_main;
__weak VLCMain *o_main;
input_thread_t *p_current_input;
dispatch_queue_t informInputChangedQueue;
......
......@@ -106,10 +106,10 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
@interface PLModel ()
{
playlist_t *p_playlist;
NSOutlineView *_outlineView;
__weak NSOutlineView *_outlineView;
// TODO: for transition
VLCPlaylist *_playlist;
__weak VLCPlaylist *_playlist;
NSUInteger _retainedRowSelection;
}
@end
......
......@@ -78,7 +78,9 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@property (readonly) VLCVoutWindowController* voutController;
@property (readonly) BOOL nativeFullscreenMode;
@property (nonatomic, readwrite) BOOL playlistUpdatedSelectorInQueue;
+ (VLCMain *)sharedInstance;
+ (void)killInstance;
- (intf_thread_t *)intf;
- (void)setIntf:(intf_thread_t *)p_mainintf;
......
......@@ -97,6 +97,7 @@ void CloseIntf (vlc_object_t *p_this)
@autoreleasepool {
msg_Dbg(p_this, "Closing macosx interface");
[[VLCMain sharedInstance] applicationWillTerminate:nil];
[VLCMain killInstance];
}
}
......@@ -174,9 +175,10 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
#pragma mark -
#pragma mark Initialization
static VLCMain *sharedInstance = nil;
+ (VLCMain *)sharedInstance
{
static VLCMain *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
......@@ -186,6 +188,11 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
return sharedInstance;
}
+ (void)killInstance
{
sharedInstance = nil;
}
- (id)init
{
self = [super init];
......@@ -374,8 +381,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
[[NSUserDefaults standardUserDefaults] synchronize];
o_mainwindow = NULL;
[self setIntf:nil];
}
#pragma mark -
......
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