mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
GstGtkGLSink: Post error if widget gets destroyed
https://bugzilla.gnome.org/show_bug.cgi?id=751104
This commit is contained in:
parent
72b48a39d8
commit
b71b7dc9e6
2 changed files with 15 additions and 0 deletions
|
@ -161,6 +161,12 @@ gst_gtk_gl_sink_finalize (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
widget_destroy_cb (GtkWidget * widget, GstGtkGLSink * gtk_sink)
|
||||
{
|
||||
g_atomic_int_set (>k_sink->widget_destroyed, 1);
|
||||
}
|
||||
|
||||
static GtkGstGLWidget *
|
||||
gst_gtk_gl_sink_get_widget (GstGtkGLSink * gtk_sink)
|
||||
{
|
||||
|
@ -188,6 +194,8 @@ gst_gtk_gl_sink_get_widget (GstGtkGLSink * gtk_sink)
|
|||
/* Take the floating ref, otherwise the destruction of the container will
|
||||
* make this widget disapear possibly before we are done. */
|
||||
gst_object_ref_sink (gtk_sink->widget);
|
||||
g_signal_connect (gtk_sink->widget, "destroy",
|
||||
G_CALLBACK (widget_destroy_cb), gtk_sink);
|
||||
|
||||
return gtk_sink->widget;
|
||||
}
|
||||
|
@ -426,6 +434,12 @@ gst_gtk_gl_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
|
||||
gtk_gst_gl_widget_set_buffer (gtk_sink->widget, buf);
|
||||
|
||||
if (g_atomic_int_get (>k_sink->widget_destroyed)) {
|
||||
GST_ELEMENT_ERROR (gtk_sink, RESOURCE, NOT_FOUND,
|
||||
("%s", "Output widget was destroyed"), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ struct _GstGtkGLSink
|
|||
GstVideoSink parent;
|
||||
|
||||
GtkGstGLWidget *widget;
|
||||
gboolean widget_destroyed;
|
||||
|
||||
GstVideoInfo v_info;
|
||||
GstBufferPool *pool;
|
||||
|
|
Loading…
Reference in a new issue