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

David Fuhrmann git at videolan.org
Sun May 27 11:24:53 CEST 2012


vlc/vlc-2.0 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon May 21 21:20:04 2012 +0200| [bff6ee5e66070829d66e21eae2ec11901a336128] | 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.
(cherry picked from commit 0d847ccb8d2e58147fe351a10fc89e777f469fb8)

Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>

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

 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 2de9bc0..94d3958 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