Fix (unreported) crash in blendkernel unittest in debug builds. #108189

Merged
Bastien Montagne merged 1 commits from mont29/blender:PR-fix-gtests into blender-v3.6-release 2023-05-23 15:55:17 +02:00

1 Commits

Author SHA1 Message Date
Bastien Montagne 2d1d3d502a Fix (unreported) crash in blendkernel unittest in debug builds.
Some `ImagePartialUpdateTest` test are calling code that needs access to
a valid `G_MAIN`. So store the generated main there as part of the setup
step, and reset G_MAIN to its original value (should be NULL) in the
teardown step.

NOTE: Things like `ID_BLEND_PATH_FROM_GLOBAL` and
`BKE_main_blendfile_path_from_global` are pure evil. It may be necessary
in a very few small cases, but their current usages need a lot of strong
cleanup.
2023-05-23 15:36:51 +02:00