GNOME Bugzilla – Bug 693696
Fix startup with gnome-shell and cogl-1.14
Last modified: 2013-02-13 18:51:48 UTC
I don't know why this happens on my machine and not others, but here's something that fixes it. Things of note: * the cogl pango font map uses the default context, and clutter uses that to set xsettings on, so that means that the default context is created, and then clutter creates a new cogl context. * as we set the default context to the context in cogl_context_new, we'll leak the existing default cogl context if it exists, meaning that we leak a cogl context in clutter's case. * while i believe the above is a bug, you can't fix it, as things like the default context pipeline are always initialized on the default context. It's not worth putting much effort into fixing this if Cogl 2.0 is around the corner, but it's worth mentioning.
Created attachment 235872 [details] [review] cogl-context: Remove the unused buffer_types variable
Created attachment 235873 [details] [review] cogl-texture: Make the list of registered types global, not per-context If we make this per-context and create two Cogl contexts, some types won't re-register, and we'll be in a broken state where some types will be considered not to be texture types.
Thanks for the patches and the report. I think this bug is triggered by the gtk-fontconfig-timestamp setting. This gets set whenever something modifies the config for fontconfig. Maybe Jasper had installed a new font or modified some other setting before running Gnome Shell. I can replicate the bug if I run this before running GS: sudo touch /etc/fonts/fonts.conf I think we ought to try to prevent Clutter from creating two contexts as well as applying Jasper's patches because Cogl isn't currently designed to cope with multiple contexts and it seems like it should fall apart more drastically. This bug is new in Cogl 1.14 because previously creating a cogl font map didn't try to get the default context.
Created attachment 235890 [details] [review] settings: Don't reload config for fontconfig if there's no fontmap If anything in the system changes the config for fontconfig then an XSetting will be set to record the last timestamp of the config file. This is presumably so that applications can be notified that it has changed and can reload the configuration. However once this setting is set it will remain set for the lifetime of the X server. This causes Clutter to handle the setting during the initialisation of the backend. Previously this would cause problems because Clutter would end up creating the default PangoFontMap before the backend has created the CoglContext. The PangoFontMap would in turn cause the default CoglContext to be created. Clutter will then later create its own CoglContext which means there will be two and the first one will be leaked. Cogl currently can't really cope with multiple contexts being created so it falls apart. This patch fixes it to skip reloading the config for fontconfig if there isn't a default font map yet. The config will presumably naturally be read with the latest values when it is finally created anyway so it doesn't need to be read immediately.
I've pushed all the patches to the various stable and master branches. Thanks again for looking into this.