From a5aff145a20ceb8392dd236b8e605b940daedf9b Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 5 Sep 2017 16:14:02 +1000 Subject: [PATCH] gl/wayland: call eglTerminate() before wl_display_disconnect() Calling these two functions in the wrong order will result in use-after-free inside wayland. https://bugzilla.gnome.org/show_bug.cgi?id=787293 --- gst-libs/gst/gl/wayland/gstgldisplay_wayland.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c index a7ca203e61..ed974a88c9 100644 --- a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c +++ b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c @@ -91,6 +91,10 @@ gst_gl_display_wayland_finalize (GObject * object) { GstGLDisplayWayland *display_wayland = GST_GL_DISPLAY_WAYLAND (object); + /* Cause eglTerminate() to occur before wl_display_disconnect() + * https://bugzilla.gnome.org/show_bug.cgi?id=787293 */ + g_object_set_data (object, "gst.gl.display.egl", NULL); + if (!display_wayland->foreign_display && display_wayland->display) { wl_display_flush (display_wayland->display); wl_display_disconnect (display_wayland->display);