Fix USD I/O crashing on reports by using new wmJob report system.

Calling `WM_report` & co API from wmJob worker thread is utterly unsafe,
and should never have been done. It 'worked' so far presumably because
worker threads were barely (if ever) reporting anything that way, but
now USD IO code is spamming reports in some cases, leading to fairly
common crashes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113883
This commit is contained in:
Bastien Montagne
2023-10-13 11:46:02 +02:00
committed by Gitea
parent 21c8af467d
commit b684864561
29 changed files with 560 additions and 312 deletions

View File

@@ -46,8 +46,12 @@ class USDImportTest(AbstractUSDTest):
self.assertEqual({'FINISHED'}, res, f"Unable to import USD file {infile}")
infile = str(self.testdir / "this_file_doesn't_exist.usda")
res = bpy.ops.wm.usd_import(filepath=infile)
self.assertEqual({'CANCELLED'}, res, "Was somehow able to import a non-existent USD file!")
# RPT_ERROR Reports from operators generate `RuntimeError` python exceptions.
try:
res = bpy.ops.wm.usd_import(filepath=infile)
self.assertEqual({'CANCELLED'}, res, "Was somehow able to import a non-existent USD file!")
except RuntimeError as e:
self.assertTrue(e.args[0].startswith("Error: USD Import: unable to open stage to read"))
def test_import_prim_hierarchy(self):
"""Test importing a simple object hierarchy from a USDA file."""