ID 497016 - Running Python API calls with wrong argument types can crash Mari

Follow

Problem summary
Running Python API calls with wrong argument types can crash Mari

Customer reported version
Mari 5.0v1

Customer reported platform
Windows 10

Steps to reproduce

1) Open any project

2) Run this snippet in the Python Console: mari.shelves.removeShelf(300)

NOTE: This crash can occur when using incorrect argument types with other methods, including the examples below:

mari.palettes.create('Test', [])
mari.projects.create(1,1,1)
mari.actions.shortcut(1)
mari.projectors.create([])

Expected behaviour
An error should be returned:

mari.shelves.removeShelf(300)
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'mari.ShelfManager.removeShelf' called with wrong argument types:
mari.ShelfManager.removeShelf(int)
Supported signatures:
mari.ShelfManager.removeShelf(mari.Mari::Shelf)

Actual behaviour
Mari crashes.

Workaround
Unknown.

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

Unable to reproduce bug in:
Mari 4.7v5 - Windows 10 - CentOS 7.9

Earliest version tested
Mari 4.7v5 - This issue doesn't appear in this version and has regressed


    We're sorry to hear that

    Please tell us why