Add a mechanism to abort a blend file reading on critical error - Blender 3.3 LTS #105486

Merged
Philipp Oeser merged 5 commits from mont29/blender:tmp-3.3-abort-fileread into blender-v3.3-release 2023-03-16 13:55:09 +01:00

5 Commits

Author SHA1 Message Date
Bastien Montagne a05b02d824 Fix failing test after own recent commit regarding Main freeing function.
buildbot/vexp-code-patch-coordinator Build done. Details
3e5ce23c99 introduced a regression in case the freed Main was part of a
list, and was supposed to be removed from it, since calling
`BLI_remlink` does _not_ clear the `prev`/`next` pointers of the removed
link.

This commit also contains a few more tweaks to recent related b3f42d8e98
commit.
2023-03-06 13:03:14 +01:00
Bastien Montagne f5e3cbaebb Cleanup: Add warning to ListBase's `BLI_remlink` regarding not cleared prev/next pointers.
While this behavior can be useful in some cases, it can also create
issues (as in one of own recent commits, 3e5ce23c99), since it
implicetly keeps the removed linknode 'linked' to the listbase.

At least warn about it in the documentation of `BLI_remlink`.
2023-03-06 13:03:13 +01:00
Bastien Montagne 9fbbe78a85 Fix #99836: Blender SEGV when open .blend file in blender.
Use recent 'abort file reading' mechanism to simply not try to load such
purposedly broken .blend files at all.
2023-03-06 13:03:13 +01:00
Bastien Montagne 9c6035eaaa Add a mechanism to abort a blend file reading on critical error.
This commit introduces a new Main boolean flag that marks is as invalid.

Higher-level file reading code does checks on this flag to abort reading
process if needed.

This is an implementation of the #105083 design task.

Given the extense of the change, I do not think this should be
considered for 3.5 and previous LTS releases.
2023-03-06 13:03:07 +01:00
Bastien Montagne 69c4d6f2a8 Fix (unreported) potential leak in Main freeing function.
Could happen in case a 'split-by-libraries' Main is passed to
`BKE_main_free`.
2023-03-06 11:54:58 +01:00