gl: win32: do not call SetParent in release_parent_win_id()
authorXavier Claessens <xavier.claessens@collabora.com>
Thu, 21 May 2015 19:30:34 +0000 (15:30 -0400)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:02 +0000 (19:32 +0000)
When called from gst_gl_window_win32_close(), internal window
could not exist, and if it does it's going to be destroyed just
after that anyway. Also it causes window_proc() to be called
and crash because it gets a NULL context.

When called from gst_gl_window_win32_set_window_handle() we are
going to set another parent anyway, and it's probably better to
reparent directly instead of passing by a NULL parent which could
cause the internal window to popup briefly.

https://bugzilla.gnome.org/show_bug.cgi?id=749601

gst-libs/gst/gl/win32/gstglwindow_win32.c

index b17d28b..bead38b 100644 (file)
@@ -182,6 +182,7 @@ set_parent_win_id (GstGLWindowWin32 * window_win32)
     /* no parent so the internal window needs borders and system menu */
     SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
         WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
+    SetParent (window_win32->internal_win_id, NULL);
     return;
   }
 
@@ -229,7 +230,6 @@ release_parent_win_id (GstGLWindowWin32 * window_win32)
 
   SetWindowLongPtr (window_win32->parent_win_id, GWLP_WNDPROC,
       (LONG_PTR) parent_proc);
-  SetParent (window_win32->internal_win_id, NULL);
 
   RemoveProp (window_win32->parent_win_id, "gl_window_parent_proc");
 }