diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-17 02:00:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-17 02:03:22 +0300 |
commit | a19e3bdad8d41cb83947ae23009fe0038a02bfaf (patch) | |
tree | 29bcec4446de7d8b2ee44219b300d08e68365a50 | |
parent | 9d1ae07d4fe347c8ddd37c9c1b2e35d31c0690e1 (diff) |
Fix T53810: Crash removing a scene used in render
Header drawing accesses the scene too.
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 6ddf78290aa..54adb121fe8 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -89,6 +89,18 @@ static void image_scopes_tag_refresh(ScrArea *sa) sima->scopes.ok = 0; } +static void image_user_refresh_scene(const bContext *C, SpaceImage *sima) +{ + if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) { + /* for render result, try to use the currently rendering scene */ + Scene *render_scene = ED_render_job_get_current_scene(C); + if (render_scene) { + sima->iuser.scene = render_scene; + return; + } + } + sima->iuser.scene = CTX_data_scene(C); +} /* ******************** manage regions ********************* */ @@ -699,17 +711,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - /* put scene context variable in iuser */ - if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) { - /* for render result, try to use the currently rendering scene */ - Scene *render_scene = ED_render_job_get_current_scene(C); - if (render_scene) - sima->iuser.scene = render_scene; - else - sima->iuser.scene = scene; - } - else - sima->iuser.scene = scene; + image_user_refresh_scene(C, sima); /* we set view2d from own zoom and offset each time */ image_main_region_set_view2d(sima, ar); @@ -961,6 +963,11 @@ static void image_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) static void image_header_region_draw(const bContext *C, ARegion *ar) { + ScrArea *sa = CTX_wm_area(C); + SpaceImage *sima = sa->spacedata.first; + + image_user_refresh_scene(C, sima); + ED_region_header(C, ar); } |