mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-21 22:58:16 +00:00
glwindow/cocoa: keep a window reference across an async callback
Esnures that the window is alive when the callback is fired. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6566>
This commit is contained in:
parent
b7b2b80de1
commit
592f85fd6c
1 changed files with 2 additions and 1 deletions
|
@ -286,6 +286,7 @@ gst_gl_window_cocoa_set_window_handle (GstGLWindow * window, guintptr handle)
|
||||||
priv = window_cocoa->priv;
|
priv = window_cocoa->priv;
|
||||||
|
|
||||||
if (priv->internal_win_id) {
|
if (priv->internal_win_id) {
|
||||||
|
GstGLWindowCocoa *window_cocoa2 = gst_object_ref (window_cocoa);
|
||||||
if (handle) {
|
if (handle) {
|
||||||
priv->external_view = (gpointer)handle;
|
priv->external_view = (gpointer)handle;
|
||||||
priv->visible = TRUE;
|
priv->visible = TRUE;
|
||||||
|
@ -295,7 +296,6 @@ gst_gl_window_cocoa_set_window_handle (GstGLWindow * window, guintptr handle)
|
||||||
priv->visible = FALSE;
|
priv->visible = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dispatch_async (dispatch_get_main_queue (), ^{
|
dispatch_async (dispatch_get_main_queue (), ^{
|
||||||
GstGLNSWindow *internal_win_id =
|
GstGLNSWindow *internal_win_id =
|
||||||
(__bridge GstGLNSWindow *)window_cocoa->priv->internal_win_id;
|
(__bridge GstGLNSWindow *)window_cocoa->priv->internal_win_id;
|
||||||
|
@ -310,6 +310,7 @@ gst_gl_window_cocoa_set_window_handle (GstGLWindow * window, guintptr handle)
|
||||||
[external_view setAutoresizesSubviews: YES];
|
[external_view setAutoresizesSubviews: YES];
|
||||||
[view setFrame: [external_view bounds]];
|
[view setFrame: [external_view bounds]];
|
||||||
[view setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
[view setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
||||||
|
gst_object_unref (window_cocoa2);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
/* no internal window yet so delay it to the next drawing */
|
/* no internal window yet so delay it to the next drawing */
|
||||||
|
|
Loading…
Reference in a new issue