diff options
author | IRIE Shinsuke <irieshinsuke@yahoo.co.jp> | 2013-12-05 10:22:55 +0400 |
---|---|---|
committer | IRIE Shinsuke <irieshinsuke@yahoo.co.jp> | 2013-12-05 11:08:10 +0400 |
commit | c17266ff548a28b1d848b84f90300bb3dbc60379 (patch) | |
tree | 7ca8adf6b88d76c088eef88d6d9a49769ac87567 /source/blender/editors | |
parent | 6976866d5ada2bd25216c84cb6f6f6fa2aa7aea5 (diff) |
Blender Internal: Fix for rendered view crash that happens when changing screen or area type
This crash is very similar to T36936. If changing screen or area type
buried the rendered view, popping up it again may cause the crash by
corrupted render database.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index c81c3c79350..3f7d599f5d5 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -261,6 +261,19 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d) } #endif +static void view3d_stop_render_preview(wmWindowManager *wm, ARegion *ar) +{ + RegionView3D *rv3d = ar->regiondata; + + if (rv3d->render_engine) { + WM_jobs_kill_type(wm, ar, WM_JOB_TYPE_RENDER_PREVIEW); + if (rv3d->render_engine->re) + RE_Database_Free(rv3d->render_engine->re); + RE_engine_free(rv3d->render_engine); + rv3d->render_engine = NULL; + } +} + void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *sa) { wmWindowManager *wm = bmain->wm.first; @@ -269,15 +282,8 @@ void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *sa) ARegion *ar; for (ar = sa->regionbase.first; ar; ar = ar->next) { - RegionView3D *rv3d = ar->regiondata; - - if (rv3d && rv3d->render_engine) { - WM_jobs_kill_type(wm, ar, WM_JOB_TYPE_RENDER_PREVIEW); - if (rv3d->render_engine->re) - RE_Database_Free(rv3d->render_engine->re); - RE_engine_free(rv3d->render_engine); - rv3d->render_engine = NULL; - } + if (ar->regiondata) + view3d_stop_render_preview(wm, ar); } } } @@ -508,14 +514,11 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar) } -static void view3d_main_area_exit(wmWindowManager *UNUSED(wm), ARegion *ar) +static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; - if (rv3d->render_engine) { - RE_engine_free(rv3d->render_engine); - rv3d->render_engine = NULL; - } + view3d_stop_render_preview(wm, ar); if (rv3d->gpuoffscreen) { GPU_offscreen_free(rv3d->gpuoffscreen); |