Commit 1b61e0df authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Mac OS X gui: Hopefuly fix the fullscreen change crash by back porting the...

Mac OS X gui: Hopefuly fix the fullscreen change crash by back porting the NSView main thread creation fix.
parent a952d608
...@@ -305,7 +305,7 @@ struct intf_sys_t ...@@ -305,7 +305,7 @@ struct intf_sys_t
- (id)getEmbeddedList; - (id)getEmbeddedList;
- (id)getInteractionList; - (id)getInteractionList;
- (id)getVoutMenu; - (id)getVoutMenu;
- (void)terminate; - (void)applicationWillTerminate:(NSNotification *)notification;
- (NSString *)localizedString:(char *)psz; - (NSString *)localizedString:(char *)psz;
- (char *)delocalizeString:(NSString *)psz; - (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width; - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
......
...@@ -102,6 +102,8 @@ void E_(CloseIntf) ( vlc_object_t *p_this ) ...@@ -102,6 +102,8 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* Run: main loop * Run: main loop
*****************************************************************************/ *****************************************************************************/
jmp_buf jmpbuffer;
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{ {
/* Do it again - for some unknown reason, vlc_thread_create() often /* Do it again - for some unknown reason, vlc_thread_create() often
...@@ -110,8 +112,11 @@ static void Run( intf_thread_t *p_intf ) ...@@ -110,8 +112,11 @@ static void Run( intf_thread_t *p_intf )
vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW ); vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );
[[VLCMain sharedInstance] setIntf: p_intf]; [[VLCMain sharedInstance] setIntf: p_intf];
[NSBundle loadNibNamed: @"MainMenu" owner: NSApp]; [NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
[NSApp run];
[[VLCMain sharedInstance] terminate]; /* Install a jmpbuffer to where we can go back before the NSApp exit
* see applicationWillTerminate: */
if(setjmp(jmpbuffer) == 0)
[NSApp run];
} }
int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
...@@ -1517,8 +1522,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1517,8 +1522,9 @@ static VLCMain *_o_sharedMainInstance = nil;
#undef p_input #undef p_input
} }
- (void)terminate - (void)applicationWillTerminate:(NSNotification *)notification
{ {
NSLog(@"applicationWillTerminate");
playlist_t * p_playlist; playlist_t * p_playlist;
vout_thread_t * p_vout; vout_thread_t * p_vout;
......
...@@ -166,18 +166,18 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this ) ...@@ -166,18 +166,18 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
} }
else else
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
p_vout->p_sys->b_embedded = VLC_FALSE; p_vout->p_sys->b_embedded = VLC_FALSE;
p_vout->p_sys->b_saved_frame = NO;
p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init]; [VLCGLView performSelectorOnMainThread:@selector(initVout:) withObject:[NSValue valueWithPointer:p_vout] waitUntilDone:YES];
/* Create the GL view */ [o_pool release];
p_vout->p_sys->o_glview = [[VLCGLView alloc] initWithVout: p_vout];
[p_vout->p_sys->o_glview autorelease];
/* Spawn the window */ /* Check to see if initVout: was successfull */
if( !(p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout if( !p_vout->p_sys->o_vout_view )
subView: p_vout->p_sys->o_glview frame: nil]) )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -201,12 +201,12 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this ) ...@@ -201,12 +201,12 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this )
{ {
aglDestroyContext(p_vout->p_sys->agl_ctx); aglDestroyContext(p_vout->p_sys->agl_ctx);
} }
else else if(!VLCIntf->b_die)
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
/* Close the window */ /* Close the window */
[p_vout->p_sys->o_vout_view closeVout]; [p_vout->p_sys->o_vout_view performSelectorOnMainThread:@selector(closeVout) withObject:NULL waitUntilDone:YES];
[o_pool release]; [o_pool release];
} }
...@@ -252,29 +252,13 @@ static int Manage( vout_thread_t * p_vout ) ...@@ -252,29 +252,13 @@ static int Manage( vout_thread_t * p_vout )
[[p_vout->p_sys->o_vout_view getWindow ]frame].origin; [[p_vout->p_sys->o_vout_view getWindow ]frame].origin;
p_vout->p_sys->b_saved_frame = VLC_TRUE; p_vout->p_sys->b_saved_frame = VLC_TRUE;
} }
[p_vout->p_sys->o_vout_view closeVout]; [p_vout->p_sys->o_vout_view performSelectorOnMainThread:@selector(closeVout) withObject:NULL waitUntilDone:YES];
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
#define o_glview p_vout->p_sys->o_glview [VLCGLView performSelectorOnMainThread:@selector(initVout:) withObject:[NSValue valueWithPointer:p_vout] waitUntilDone:YES];
o_glview = [[VLCGLView alloc] initWithVout: p_vout];
[o_glview autorelease];
if( p_vout->p_sys->b_saved_frame )
{
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_glview
frame: &p_vout->p_sys->s_frame];
}
else
{
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_glview frame: nil];
}
[[o_glview openGLContext] makeCurrentContext]; [[p_vout->p_sys->o_glview openGLContext] makeCurrentContext];
#undef o_glview
[o_pool release]; [o_pool release];
...@@ -337,6 +321,22 @@ static void Unlock( vout_thread_t * p_vout ) ...@@ -337,6 +321,22 @@ static void Unlock( vout_thread_t * p_vout )
* VLCGLView implementation * VLCGLView implementation
*****************************************************************************/ *****************************************************************************/
@implementation VLCGLView @implementation VLCGLView
+ (void)initVout:(NSValue *)arg
{
vout_thread_t * p_vout = [arg pointerValue];
NSRect * frame;
/* Create the GL view */
p_vout->p_sys->o_glview = [[VLCGLView alloc] initWithVout: p_vout];
[p_vout->p_sys->o_glview autorelease];
/* Spawn the window */
frame = p_vout->p_sys->b_saved_frame ? &p_vout->p_sys->s_frame : nil;
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: p_vout->p_sys->o_glview
frame: frame];
}
- (id) initWithVout: (vout_thread_t *) vout - (id) initWithVout: (vout_thread_t *) vout
{ {
......
...@@ -492,6 +492,7 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -492,6 +492,7 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
- (void)terminate: (id)sender - (void)terminate: (id)sender
{ {
o_vlc->b_die = VLC_TRUE; o_vlc->b_die = VLC_TRUE;
[super terminate: sender];
} }
@end @end
......
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