Fix removing composer legend items. Fix #7874 Fix #7464