Objects stay editable even after locking them if selected

Summary:

If we lock some object or layer, the lock isn't enforced before clicking outside if we already have the object selected when locking.

Steps to reproduce:

  1. Open Inkscape
  2. Draw anything
  3. Open the Layers and Objects panel
  4. Select the Object previously drawn
  5. Click the Lock option in the panel

The order between step 2 and 3 doesn't really matter.

What happened?

Object selected remained editable.

What should have happened?

Object should have been locked as soon as clicking on the lock option.

Sample attachments: locknotlocking

Also, this circle appears when clicking on an empty panel. Circle!

Version Info:

Inkscape 1.3-beta (cedbd6c6ff, 2023-05-28)

    GLib version:     2.76.3
    GTK version:      3.24.38
    glibmm version:   2.66.6
    gtkmm version:    3.24.7
    libxml2 version:  2.10.4
    libxslt version:  1.1.38
    Cairo version:    1.17.7
    Pango version:    1.50.14
    HarfBuzz version: 7.3.0

    OS version:       Windows 11 22H2