mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
gl/cocoa: make gst_gl_window_cocoa_send_message_async re-entrant
Backends that use g_main_context_invoke are re-entrant. Il allows to call two nested gst_gl_context_thread_add. ex: init_upload / init_colorconvert
This commit is contained in:
parent
aab3ef1b5d
commit
9d396a2495
1 changed files with 13 additions and 6 deletions
|
@ -334,14 +334,21 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
|
||||||
if (window) {
|
if (window) {
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc]
|
/* performSelector is not re-entrant so do it manually */
|
||||||
initWithAll:window_cocoa callback:callback userData:data];
|
if (G_UNLIKELY ([NSThread currentThread] == priv->thread)) {
|
||||||
|
if (callback)
|
||||||
|
callback (data);
|
||||||
|
} else {
|
||||||
|
AppThreadPerformer* app_thread_performer =
|
||||||
|
[[AppThreadPerformer alloc] initWithAll:window_cocoa
|
||||||
|
callback:callback userData:data];
|
||||||
|
|
||||||
[app_thread_performer performSelector:@selector(sendToApp) onThread:priv->thread
|
[app_thread_performer performSelector:@selector(sendToApp)
|
||||||
withObject:nil waitUntilDone:NO];
|
onThread:priv->thread withObject:nil waitUntilDone:NO];
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================================*/
|
/* =============================================================*/
|
||||||
|
|
Loading…
Reference in a new issue