From 2998b97d5e14b114637daba976e159a9275783d9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 8 Oct 2025 16:28:56 +0200 Subject: [PATCH] Fix #147626: Crash when clicking on the "Rendering" workspace Make the logic in the image editor drawing robust against configuration when the image editor has flag "show render result from sequencer scene" and the sequencer scene being nullptr. It could happen when user configures image editor is such way and then removes the sequencer scene. Or, it could also happen when the image editor has the flag set, which was exactly the cause of the originally reported issue. So this change also clears the flag which was expected to be cleared. It could affect some current files saved in the past day, but since the render operator sets it based on the way the scene is rendered it is not too bad. Caused by 76c03744a809365af98f4d8356ebaeb0a5e2e831 Pull Request: https://projects.blender.org/blender/blender/pulls/147630 --- source/blender/blenkernel/BKE_blender_version.h | 2 +- source/blender/blenloader/intern/versioning_500.cc | 13 +++++++++++++ source/blender/editors/space_image/space_image.cc | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index e1aaa20d465..28640e39d1f 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 107 +#define BLENDER_FILE_SUBVERSION 108 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and cancel loading the file, showing a warning to diff --git a/source/blender/blenloader/intern/versioning_500.cc b/source/blender/blenloader/intern/versioning_500.cc index 6464f59d292..108430b7645 100644 --- a/source/blender/blenloader/intern/versioning_500.cc +++ b/source/blender/blenloader/intern/versioning_500.cc @@ -3965,6 +3965,19 @@ void blo_do_versions_500(FileData *fd, Library * /*lib*/, Main *bmain) } } + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 108)) { + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_IMAGE) { + SpaceImage *sima = reinterpret_cast(sl); + sima->iuser.flag &= ~IMA_SHOW_SEQUENCER_SCENE; + } + } + } + } + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check. diff --git a/source/blender/editors/space_image/space_image.cc b/source/blender/editors/space_image/space_image.cc index 6603796b1fb..c6cfca0830e 100644 --- a/source/blender/editors/space_image/space_image.cc +++ b/source/blender/editors/space_image/space_image.cc @@ -76,8 +76,10 @@ static void image_scopes_tag_refresh(ScrArea *area) static void image_user_refresh_scene(const bContext *C, SpaceImage *sima) { /* Update scene image user for acquiring render results. */ - sima->iuser.scene = (sima->iuser.flag & IMA_SHOW_SEQUENCER_SCENE) ? CTX_data_sequencer_scene(C) : - CTX_data_scene(C); + Scene *sequencer_scene = CTX_data_sequencer_scene(C); + sima->iuser.scene = (sima->iuser.flag & IMA_SHOW_SEQUENCER_SCENE) && sequencer_scene ? + sequencer_scene : + CTX_data_scene(C); if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) { /* While rendering, prefer scene that is being rendered. */