[vlc-commits] macosx: fix subtile bug in initialization of mainwindow

David Fuhrmann git at videolan.org
Mon May 21 21:30:15 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon May 21 21:20:04 2012 +0200| [0d847ccb8d2e58147fe351a10fc89e777f469fb8] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d847ccb8d2e58147fe351a10fc89e777f469fb8
---

 modules/gui/macosx/MainWindow.m |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 59547d4..f4c92e7 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -56,14 +56,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
 - (id)init
 {
-    if( _o_sharedInstance)
+    if( _o_sharedInstance )
     {
         [self dealloc];
         return _o_sharedInstance;
     }
     else
     {
-        o_fspanel = [[VLCFSPanel alloc] init];
         _o_sharedInstance = [super init];
     }
 
@@ -89,6 +88,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
     self = [super initWithContentRect:contentRect styleMask:styleMask
                               backing:backingType defer:flag];
+    _o_sharedInstance = self;
 
     [[VLCMain sharedInstance] updateTogglePlaylistState];
 



More information about the vlc-commits mailing list