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
- (id)getEmbeddedList;
- (id)getInteractionList;
- (id)getVoutMenu;
- (void)terminate;
- (void)applicationWillTerminate:(NSNotification *)notification;
- (NSString *)localizedString:(char *)psz;
- (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
......
......@@ -102,6 +102,8 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
/*****************************************************************************
* Run: main loop
*****************************************************************************/
jmp_buf jmpbuffer;
static void Run( intf_thread_t *p_intf )
{
/* Do it again - for some unknown reason, vlc_thread_create() often
......@@ -110,8 +112,11 @@ static void Run( intf_thread_t *p_intf )
vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );
[[VLCMain sharedInstance] setIntf: p_intf];
[NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
/* Install a jmpbuffer to where we can go back before the NSApp exit
* see applicationWillTerminate: */
if(setjmp(jmpbuffer) == 0)
[NSApp run];
[[VLCMain sharedInstance] terminate];
}
int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
......@@ -1517,8 +1522,9 @@ static VLCMain *_o_sharedMainInstance = nil;
#undef p_input
}
- (void)terminate
- (void)applicationWillTerminate:(NSNotification *)notification
{
NSLog(@"applicationWillTerminate");
playlist_t * p_playlist;
vout_thread_t * p_vout;
......
......@@ -166,18 +166,18 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
}
else
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
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 */
p_vout->p_sys->o_glview = [[VLCGLView alloc] initWithVout: p_vout];
[p_vout->p_sys->o_glview autorelease];
[o_pool release];
/* Spawn the window */
/* Check to see if initVout: was successfull */
if( !(p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: p_vout->p_sys->o_glview frame: nil]) )
if( !p_vout->p_sys->o_vout_view )
{
return VLC_EGENERIC;
}
......@@ -201,12 +201,12 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this )
{
aglDestroyContext(p_vout->p_sys->agl_ctx);
}
else
else if(!VLCIntf->b_die)
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
/* 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];
}
......@@ -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->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;
#define o_glview p_vout->p_sys->o_glview
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];
}
[VLCGLView performSelectorOnMainThread:@selector(initVout:) withObject:[NSValue valueWithPointer:p_vout] waitUntilDone:YES];
[[o_glview openGLContext] makeCurrentContext];
#undef o_glview
[[p_vout->p_sys->o_glview openGLContext] makeCurrentContext];
[o_pool release];
......@@ -337,6 +321,22 @@ static void Unlock( vout_thread_t * p_vout )
* VLCGLView implementation
*****************************************************************************/
@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
{
......
......@@ -492,6 +492,7 @@ static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
- (void)terminate: (id)sender
{
o_vlc->b_die = VLC_TRUE;
[super terminate: sender];
}
@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