When using the context menu "select unlocked" and "select locked" depending on whether all layers of the desired type are selected it succeeds. Steps to reproduce: 1) Create two layers one locked and one unlocked 2) Select unlocked layer 3) Right click the selected layer then select > select unlocked Instead of selecting only the present layer you will now be selecting the locked layer. This applies to any case where all the layers of the kind you want to select are selected so works inversely as described aswell.
Created attachment 158437 [details] the svg file
Sorry for the noise earlier with the wrong attachment. I can confirm the issue, thanks for the report!
Okay, this behavior is intentional, so that one could assign this action to a keyboard shortcut and press twice to get an inverted behavior. I feel like we should close this bug as "intentional", but I would like to hear an opinion from painters first...