GNOME Bugzilla – Bug 728064
New AtlasTextures should keep designated atlas alive
Last modified: 2014-06-18 17:46:08 UTC
This is my first time with cogl, so sorry if I'm on the wrong track. I spotted this while debugging a crash I got with the current totem release (bug 727369) which hinted to some ref-counting problem in cogl with some criticals. When a new CoglAtlasTexture is created it tries to find an existing atlas it fits into. This causes a reorganization of the atlas if it's too small. However, the texture does only increase the refcount on the atlas after the reorganization. Now if the only other texture in the atlas gets freed in that reorganization step as in my case (the texture was held by a pipeline layer that get flushed by the blitting step) the new texture will try to use a no longer existing atlas afterwards.
Created attachment 274139 [details] [review] proposed fix This patch makes the texture keep the atlas alive while it expands. This fixed my problems with totem. It has one drawback though. If the described scenario occurs (one texture replacing another with the same size) the resulting atlas is likely larger than necessary.
While I can't say whether the patch is correct or not, it fixes the issue for me so it would be good if this could be looked at (hint hint :-) ).
Looks to be the same as bug 719551.
*** Bug 719551 has been marked as a duplicate of this bug. ***
*** Bug 729868 has been marked as a duplicate of this bug. ***
Thanks for the detailed bug report and patch. I think this is a good fix so I've pushed it to the master and 1.18 branches with some small changes to the comments. https://git.gnome.org/browse/cogl/commit/?id=2eec9758f67e9073371c2edd6337 I've also posted a patch for a test case to the mailing list: http://lists.freedesktop.org/archives/cogl/2014-May/001662.html
*** Bug 731870 has been marked as a duplicate of this bug. ***