Commit bff6ee5e authored by David Fuhrmann's avatar David Fuhrmann

macosx: fix subtile bug in initialization of mainwindow

Currently, two objects of the class VLCMainWindow are generated. The first is alloated
from intf.m (triggered by the first log message that arrives) and is initialized by
both init and initWithContentRect. The second object is created from inside the nib file,
and is instantiated ONLY with initWithContentRect. Therefore, up to now _o_sharedInstance
had the wrong object and all calls to sharedInstance would cause problems.
But somehow, o_mainwindow in intf.m is updated to the correct second object, although it holds
the first object at start.

Furthermore, o_fspanel is also instantiated through the nib file.
(cherry picked from commit 0d847ccb8d2e58147fe351a10fc89e777f469fb8)
Signed-off-by: default avatarDavid Fuhrmann <david.fuhrmann@googlemail.com>
parent 6965b452
...@@ -56,14 +56,13 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -56,14 +56,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (id)init - (id)init
{ {
if( _o_sharedInstance) if( _o_sharedInstance )
{ {
[self dealloc]; [self dealloc];
return _o_sharedInstance; return _o_sharedInstance;
} }
else else
{ {
o_fspanel = [[VLCFSPanel alloc] init];
_o_sharedInstance = [super init]; _o_sharedInstance = [super init];
} }
...@@ -89,6 +88,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -89,6 +88,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
self = [super initWithContentRect:contentRect styleMask:styleMask self = [super initWithContentRect:contentRect styleMask:styleMask
backing:backingType defer:flag]; backing:backingType defer:flag];
_o_sharedInstance = self;
[[VLCMain sharedInstance] updateTogglePlaylistState]; [[VLCMain sharedInstance] updateTogglePlaylistState];
......
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