GNOME Bugzilla – Bug 768989
leaks: update type filter later for unknown types
Last modified: 2016-07-20 13:31:45 UTC
.
Created attachment 331811 [details] [review] leaks: update type filter later for unknown types This allow us to filter using an object type which is implemented by a plugin like, say, GstGtkGLSink.
Comment on attachment 331811 [details] [review] leaks: update type filter later for unknown types If I'm not mistaken this isn't thread-safe at all? I believe objects and mini objects may be created simultaneously from multiple threads at the same time.
Oh right, we don't own the lock at this point. Fixing.
Created attachment 331817 [details] [review] leaks: update type filter later for unknown types This allow us to filter using an object type which is implemented by a plugin like, say, GstGtkGLSink.
It might also be more efficient to store the GQuarks for the type names in the hash table rather than the strings, and then look up the g_type_qname() instead (which also saves a few g_quark_to_string()). Maybe even get rid of the hash table entirely and just keep a GQuark * array of pending type name quarks? This is all micro-optimising of course ;)
Comment on attachment 331817 [details] [review] leaks: update type filter later for unknown types >@@ -107,6 +116,24 @@ should_handle_object_type (GstLeaksTracer * self, GType object_type) > >+ if (self->unhandled_filter) { >+ const gchar *type_name; >+ >+ type_name = g_type_name (object_type); >+ GST_OBJECT_LOCK (self); >+ if (g_hash_table_contains (self->unhandled_filter, type_name)) { ... >+ } >+ GST_OBJECT_UNLOCK (self); >+ } The if (self->unhandled_filter) is still unprotected. Maybe add an atomic int to check if there are pending unhandled types, and if so take the lock and then do if (self->unhandled_filters) ... ? Or something like that, dunno :)
Oh yeah that's good ideas, thanks! I implemented all your suggestions but kept the hash table as it makes the code easier and it should not be called that often (except if user passed an invalid object type as filter but it shouldn't be that common).
Created attachment 331818 [details] [review] leaks: update type filter later for unknown types This allow us to filter using an object type which is implemented by a plugin like, say, GstGtkGLSink.
Cool, thanks. commit 714ea372827acce932a26c5ebe77537a0fb8c34f Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Date: Wed Jul 20 12:22:10 2016 +0200 tracers: leaks: update type filter later for unknown types This allow us to filter using an object type which is implemented by a plugin like, say, GstGtkGLSink. https://bugzilla.gnome.org/show_bug.cgi?id=768989