mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-29 18:48:44 +00:00
leaks: warn if object is destroyed while the tracer is disposing
This should not happen and generally means some thread is still running. https://bugzilla.gnome.org/show_bug.cgi?id=768578
This commit is contained in:
parent
40727d9c83
commit
9ba53ff1fc
2 changed files with 11 additions and 0 deletions
|
@ -153,11 +153,19 @@ static void
|
|||
handle_object_destroyed (GstLeaksTracer * self, gpointer object)
|
||||
{
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->done) {
|
||||
g_warning
|
||||
("object %p destroyed while the leaks tracer was finalizing. Some threads are still running?",
|
||||
object);
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_hash_table_remove (self->objects, object);
|
||||
#ifdef G_OS_UNIX
|
||||
if (self->removed)
|
||||
g_hash_table_add (self->removed, object_log_new (object));
|
||||
#endif /* G_OS_UNIX */
|
||||
out:
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
|
@ -447,6 +455,8 @@ gst_leaks_tracer_finalize (GObject * object)
|
|||
GHashTableIter iter;
|
||||
gpointer obj;
|
||||
|
||||
self->done = TRUE;
|
||||
|
||||
/* Tracers are destroyed as part of gst_deinit() so now is a good time to
|
||||
* report all the objects which are still alive. */
|
||||
leaks = log_leaked (self);
|
||||
|
|
|
@ -60,6 +60,7 @@ struct _GstLeaksTracer {
|
|||
GHashTable *added;
|
||||
/* Set of owned ObjectLog. Protected by object lock */
|
||||
GHashTable *removed;
|
||||
gboolean done;
|
||||
|
||||
gboolean log_stack_trace;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue