After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 693696 - Fix startup with gnome-shell and cogl-1.14
Fix startup with gnome-shell and cogl-1.14
Status: RESOLVED FIXED
Product: cogl
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-02-13 07:20 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2013-02-13 18:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cogl-context: Remove the unused buffer_types variable (1.61 KB, patch)
2013-02-13 07:20 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
cogl-texture: Make the list of registered types global, not per-context (2.91 KB, patch)
2013-02-13 07:20 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
settings: Don't reload config for fontconfig if there's no fontmap (2.78 KB, patch)
2013-02-13 15:17 UTC, Neil Roberts
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2013-02-13 07:20:44 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.
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-02-13 07:20:46 UTC
Created attachment 235872 [details] [review]
cogl-context: Remove the unused buffer_types variable
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-02-13 07:20:49 UTC
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.
Comment 3 Neil Roberts 2013-02-13 15:17:06 UTC
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.
Comment 4 Neil Roberts 2013-02-13 15:17:42 UTC
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.
Comment 5 Neil Roberts 2013-02-13 18:51:48 UTC
I've pushed all the patches to the various stable and master branches. Thanks again for looking into this.