ID 352443 - Crash deleting Substance Output when its referenced image file is visible in the Image Viewer.

Follow

Problem summary
When the Image Viewer is open and viewing an image file being referenced by a Substance Output, deleting that Substance Output from the Shader Tree will cause Modo to crash.

Customer reported version
modo.12.0v1

Customer reported platform
n/a

Steps to reproduce

1) On a Windows 10 / macOS machine, open Modo 12.0v1 with the Substance for Modo plug-in (version 2.1.0) loaded.

2) In a new scene, create a default Sphere primitive. 

3) Add a Substance item via Texture > Substance > Create Substance. This appears in the Shader Tree above the base material layer.

4) Select the Substance material and in the Properties panel load an sbsar file.

5) With the sbsar file loaded, in the Substance materials Properties panel, enable any of the listed Render Outputs. When enabled the Render Output will appear as a new material layer in the Shader Tree.

6) Double-click on the Substance Output in the Shader Tree (the newly created material layer) to open the referenced image file in the Image Viewer.

7) Run the provided script (which deletes all Substance Outputs from the Shader Tree - Modo will crash to Desktop.

8) Alternatively, select the Substance Output in the Shader Tree and delete it. The Image Viewer window should remain open with the referenced image visible; if you select the Substance material and disable the deleted Substance Output in the Properties panel, Modo will crash to Desktop.

Workaround
Before deleting a Substance Outputs that references an image, ensure that referenced image is not being viewed by the Image Viewer.

Reproduced by support
This bug has been reproduced in:
Windows 10
12.1v1 RC 0
12.0v1
11.2v3
11.0v3
10.2v4
902

macOS 10.13
12.1v1 RC 0
902

Earliest version tested
902 - This issue appears to be in all versions of the product

Expected behaviour
The expected behaviour is that when an object is removed from the scene, the appropriate references are notified that an object is deleted.

Actual behaviour
The Image Viewer holds on to the image source after the Substance Output is removed, causing Modo to crash.  
 

    We're sorry to hear that

    Please tell us why