framepositionner: add a weak ref on track element to know when it is finalized

Otherwise if frame positionner is disposed after track element has been
finalized, it will raise a critical message because we will try to
disconnect a signal handler on a freed track element object.

https://bugzilla.gnome.org/show_bug.cgi?id=766525
This commit is contained in:
Aurélien Zanelli 2016-05-16 12:53:32 +02:00 committed by Thibault Saunier
parent 991870fa28
commit df9921f470

View file

@ -200,6 +200,12 @@ _track_changed_cb (GESTrackElement * trksrc, GParamSpec * arg G_GNUC_UNUSED,
set_track (pos);
}
static void
_trk_element_weak_notify_cb (GstFramePositioner * pos, GObject * old)
{
pos->track_source = NULL;
}
void
ges_frame_positioner_set_source_and_filter (GstFramePositioner * pos,
GESTrackElement * trksrc, GstElement * capsfilter)
@ -208,6 +214,8 @@ ges_frame_positioner_set_source_and_filter (GstFramePositioner * pos,
pos->capsfilter = capsfilter;
pos->current_track = ges_track_element_get_track (trksrc);
g_object_weak_ref (G_OBJECT (trksrc),
(GWeakNotify) _trk_element_weak_notify_cb, pos);
g_signal_connect (trksrc, "notify::track", (GCallback) _track_changed_cb,
pos);
set_track (pos);