Fix crash when rendering viewport within another area

This also Fix T55574 Crash on sequencer preview
This commit is contained in:
Clément Foucault 2018-07-31 18:20:57 +02:00
parent 7e0eb0d071
commit 6ba70d5996
Notes: blender-bot 2023-02-14 08:42:53 +01:00
Referenced by issue #55574, Crash on sequencer preview
1 changed files with 10 additions and 0 deletions

View File

@ -1412,6 +1412,12 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
ofs = NULL;
}
GPUFrameBuffer *old_fb = GPU_framebuffer_active_get();
if (old_fb) {
GPU_framebuffer_restore();
}
const bool own_ofs = (ofs == NULL);
DRW_opengl_context_enable();
@ -1556,6 +1562,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
DRW_opengl_context_disable();
if (old_fb) {
GPU_framebuffer_bind(old_fb);
}
if (ibuf->rect_float && ibuf->rect)
IMB_rect_from_float(ibuf);