[Bf-blender-cvs] [d35efde1816] filebrowser_redesign: Fix crash saving files with preview saving enabled

Julian Eisel noreply at git.blender.org
Tue Sep 3 14:53:13 CEST 2019


Commit: d35efde18163fd0820cafd4f19be1ebaad8cdc92
Author: Julian Eisel
Date:   Tue Sep 3 14:52:16 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBd35efde18163fd0820cafd4f19be1ebaad8cdc92

Fix crash saving files with preview saving enabled

===================================================================

M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index bd9d56b8466..af841f20620 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1205,6 +1205,8 @@ static ImBuf *blend_file_thumb(const bContext *C,
   /* will be scaled down, but gives some nice oversampling */
   ImBuf *ibuf;
   BlendThumbnail *thumb;
+  wmWindowManager *wm = CTX_wm_manager(C);
+  wmWindow *windrawable_old = wm->windrawable;
   char err_out[256] = "unknown";
 
   /* screen if no camera found */
@@ -1238,6 +1240,9 @@ static ImBuf *blend_file_thumb(const bContext *C,
   /* gets scaled to BLEN_THUMB_SIZE */
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
 
+  /* Offscreen drawing requires a drawable window context. */
+  wm_window_make_drawable(wm, CTX_wm_window(C));
+
   if (scene->camera) {
     ibuf = ED_view3d_draw_offscreen_imbuf_simple(depsgraph,
                                                  scene,
@@ -1270,6 +1275,14 @@ static ImBuf *blend_file_thumb(const bContext *C,
                                           err_out);
   }
 
+  /* Reset to old drawable. */
+  if (windrawable_old) {
+    wm_window_make_drawable(wm, windrawable_old);
+  }
+  else {
+    wm_window_clear_drawable(wm);
+  }
+
   if (ibuf) {
     float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);



More information about the Bf-blender-cvs mailing list