GNOME Bugzilla – Bug 469209
[patch] add accessor function for threadsafety attribute
Last modified: 2013-12-19 04:33:46 UTC
Currently the TIFF-loader and the commonly used SVG-loader (from librsvg) are marked as not threadsafe. As bug 449409 shows these loaders can produce some ugly deadlocks due to the global lock they hold when active. To know that the loader is not threadsafe the programmer needs to access the GdkPixbufFormat structure directly, which is not the "preferred" way. The following patch adds a simple function in the spirit of gdk_pixbuf_format_is_writable() to return if the format's loader is threadsafe.
Created attachment 94099 [details] [review] add gdk_pixbuf_format_is_threadsafe() Adds the above mentioned function. I am not sure if I did that alias-stuff correctly.
(In reply to comment #1) > > ... I am not sure if I did that alias-stuff correctly. > Ah, never mind looks like thats created automatically.
Matthias, is there time to add this API?
I wonder how having this accessor helps in avoiding the deadlocks.
I know that whether a pixbuf loader is thread-safe or not shouldn't matter. Therefore, at first sight, this is kind of useless addition. However, we've made a workaround for the deadlock problem in EOG (see bug #449409) and for doing so we're directly accessing GdkPixbufFormat struct (which is not good). If you prefer to just fix the deadlock problem in order to not need to check this kind of property in GdkPixbufFormat, this is ok for me. :-)
This is useless to fix the rsvg pixbuf loader bug, since to get a GdkPixbufFormat structure you first have to create a pixbuf loader, which will already cause the deadlock.
we're now mandating that loaders must be threadsafe