Skip to content

Improve readability of code that destroys frame callback resources

Vlad Zahorodnii requested to merge work/explicit-copy into master

If a frame callback resource is destroyed, it will unregister itself from corresponding lists in current, pending, and cached state.

However, this means that we need to be super duper careful when the compositor wants to destroy all frame callbacks. We need to make a copy of a frameCallbacks list; otherwise a call to removeOne() will invalidate iterators and the compositor may crash.

Currently, that copy is made implicitly. Some people may see that code and add qAsConst() without realizing the consequences it will lead to.

This change improves the readability of that code by making explicit copies of frameCallbacks in code that shuts down SurfaceInterface.

Merge request reports