I am no expert at this, but the problem seems to be quite simple: xrender_unmanage_screen in src/compositor/compositor-xrender.c always calls meta_screen_unset_cm_selection which calls XSetSelectionOwner with None as the owner. It should only do this when giving up the compositor selection manually (ICCCM 2.3.1), but instead also does it when called by meta_screen_free. By setting the selection owner to None, compiz finds that XGetSelectionOwner does not return the window which it set as the owner and aborts.
Also, the convention compiz uses (set the selection then check it to verify success) seems to be recommended at the bottom of ICCCM 2.1.
I am no expert at this, but the problem seems to be quite simple: xrender_ unmanage_ screen in src/compositor/ compositor- xrender. c always calls meta_screen_ unset_cm_ selection which calls XSetSelectionOwner with None as the owner. It should only do this when giving up the compositor selection manually (ICCCM 2.3.1), but instead also does it when called by meta_screen_free. By setting the selection owner to None, compiz finds that XGetSelectionOwner does not return the window which it set as the owner and aborts.
Also, the convention compiz uses (set the selection then check it to verify success) seems to be recommended at the bottom of ICCCM 2.1.