mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
ges: Give a reference to the formatter for the idle callback
This avoid segfault as we are not guaranteed that the formatter will not be destroyed in the meantime. + Minor cleanup of handling of private members https://bugzilla.gnome.org/show_bug.cgi?id=724337
This commit is contained in:
parent
0a25ed00a1
commit
387b234f3b
1 changed files with 20 additions and 5 deletions
|
@ -29,9 +29,10 @@ G_DEFINE_ABSTRACT_TYPE (GESBaseXmlFormatter, ges_base_xml_formatter,
|
||||||
GES_TYPE_FORMATTER);
|
GES_TYPE_FORMATTER);
|
||||||
|
|
||||||
#define _GET_PRIV(o)\
|
#define _GET_PRIV(o)\
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GES_TYPE_BASE_XML_FORMATTER, GESBaseXmlFormatterPrivate))
|
(((GESBaseXmlFormatter*) o)->priv)
|
||||||
|
|
||||||
static void _loading_done (GESFormatter * self);
|
|
||||||
|
static gboolean _loading_done_cb (GESFormatter * self);
|
||||||
|
|
||||||
typedef struct PendingEffects
|
typedef struct PendingEffects
|
||||||
{
|
{
|
||||||
|
@ -235,7 +236,7 @@ _load_from_uri (GESFormatter * self, GESTimeline * timeline, const gchar * uri,
|
||||||
|
|
||||||
if (g_hash_table_size (priv->assetid_pendingclips) == 0 &&
|
if (g_hash_table_size (priv->assetid_pendingclips) == 0 &&
|
||||||
priv->pending_assets == NULL)
|
priv->pending_assets == NULL)
|
||||||
g_idle_add ((GSourceFunc) _loading_done, self);
|
g_idle_add ((GSourceFunc) _loading_done_cb, g_object_ref (self));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -346,7 +347,12 @@ _finalize (GObject * object)
|
||||||
static void
|
static void
|
||||||
ges_base_xml_formatter_init (GESBaseXmlFormatter * self)
|
ges_base_xml_formatter_init (GESBaseXmlFormatter * self)
|
||||||
{
|
{
|
||||||
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
|
GESBaseXmlFormatterPrivate *priv;
|
||||||
|
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
|
GES_TYPE_BASE_XML_FORMATTER, GESBaseXmlFormatterPrivate);
|
||||||
|
|
||||||
|
priv = self->priv;
|
||||||
|
|
||||||
priv->check_only = FALSE;
|
priv->check_only = FALSE;
|
||||||
priv->parsecontext = NULL;
|
priv->parsecontext = NULL;
|
||||||
|
@ -411,7 +417,7 @@ _set_auto_transition (gpointer prio, LayerEntry * entry, gpointer udata)
|
||||||
static void
|
static void
|
||||||
_loading_done (GESFormatter * self)
|
_loading_done (GESFormatter * self)
|
||||||
{
|
{
|
||||||
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
|
GESBaseXmlFormatterPrivate *priv = GES_BASE_XML_FORMATTER (self)->priv;
|
||||||
|
|
||||||
if (priv->parsecontext)
|
if (priv->parsecontext)
|
||||||
g_markup_parse_context_free (priv->parsecontext);
|
g_markup_parse_context_free (priv->parsecontext);
|
||||||
|
@ -424,6 +430,15 @@ _loading_done (GESFormatter * self)
|
||||||
ges_project_set_loaded (self->project, self);
|
ges_project_set_loaded (self->project, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_loading_done_cb (GESFormatter * self)
|
||||||
|
{
|
||||||
|
_loading_done (self);
|
||||||
|
g_object_unref (self);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_set_child_property (GQuark field_id, const GValue * value,
|
_set_child_property (GQuark field_id, const GValue * value,
|
||||||
GESTrackElement * effect)
|
GESTrackElement * effect)
|
||||||
|
|
Loading…
Reference in a new issue