Bug? on (Re)-Generate automatic legend of Matplotlib Figure Property

Hello, I am using MATPLOTLIB vers 3.5.1. on WINDOWS10 with Spyder. I am running in qt mode (Detached plot window).

I am running the script

import matplotlib.pyplot as plt
plt.figure("Test2")
plt.plot([1,2,3],[0,0,0],label='zero line') 
plt.plot([1,2,3],[3,4,5],label='Slope') 
        
plt.legend()
plt.show()

MATPLOTLIB plots correctly. However, if I click on the icon “Edit Curve, Axis and Image parameters”
and then
on (RE-)generate automatic legend , the colour of the lines are switched (not sure why), whilst the legend entry order is switched (not sure why) but line colours in legend are not. Basically, after pressing regenerate automatic legend, the legend now is completely messed up because what should be zero line is now slope (please see the attached screenshot).

This is a bug in the sorting of the lines to display on the Curves tab. When the Curves list is made, the lines are sorted, but when the dialog applies the results, they are applied to the original list, which causes the colours to be swapped.