ID 497093 - Shelf Groups are not cleaned up if child Shelves are ungrouped via Python or deleted

Follow

Problem summary
Shelf Groups are not cleaned up if child Shelves are ungrouped via Python or deleted

This issue can occur if:
- Grouped Shelves are Ungrouped via Python
- Grouped Shelves are deleted via Python
- Grouped Shelves are deleted via the UI

The empty Groups are not returned after runningmari.shelves.list()

Customer reported version
Mari 4.7v5

Customer reported platform
CentOS 7.9

Steps to reproduce

Empty Groups after ungrouping via Python:

1) Launch Mari

2) Run the following script:
myshelf = mari.shelves.createShelf('myshelf')
mari.shelves.groupShelf(myshelf, '//parent1/parent2')
mari.shelves.ungroupShelf(myshelf) # move it under parent1
mari.shelves.ungroupShelf(myshelf) # move it to the top
for s in mari.shelves.list():
  print(s.path()) # this does not list parent1 or parent2

Empty Groups after Grouped Shelves are deleted via Python:

1) Launch Mari

2) Run the following script:
myshelf = mari.shelves.createShelf('myshelf')
mari.shelves.groupShelf(myshelf, '//parent1/parent2')
mari.shelves.removeShelf(myshelf)
for s in mari.shelves.list():
  print(s.path()) # this does not list parent1 or parent2

Empty Groups after Grouped Shelves are deleted via the UI:

1) Launch Mari

2) In the Shelf palette, create a Shelf and Group it

3) Delete the Shelf, notice the Group remains present

Expected behaviour
Empty Shelf Groups should be removed automatically

Actual behaviour
The empty Shelf Groups remain present, however mari.shelves.list() does not return the empty hierarchy.

Workaround
Unknown.

Reproduced by support
This bug has been reproduced in:
Mari 5.0v1 - Windows 10 - CentOS 7.9
Mari 4.8v1 - Windows 10
Mari 4.7v5 - Windows 10
Mari 4.7v4 - Windows 10
Mari 4.7v1 - Windows 10 - CentOS 7.9

Earliest version tested
Mari 4.7v1 - This feature did not exist before this version


    We're sorry to hear that

    Please tell us why