[Bf-blender-cvs] [94364be80ad] master: Fix ASAN warning after recent cleanup

Hans Goudey noreply at git.blender.org
Mon Oct 19 05:18:40 CEST 2020


Commit: 94364be80adcc5432112f96ddc06528161a1ad43
Author: Hans Goudey
Date:   Sun Oct 18 22:18:31 2020 -0500
Branches: master
https://developer.blender.org/rB94364be80adcc5432112f96ddc06528161a1ad43

Fix ASAN warning after recent cleanup

rB78a5895c96 introduced a "use after scope" warning, where a buffer
from a lower scope was used later. The solution is to only use one
variable and store whether to use it more explicitely with a bool.

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

M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 10d269151ce..af6ed8ac54e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -3030,15 +3030,15 @@ void ED_region_panels_draw(const bContext *C, ARegion *region)
   }
 
   /* scrollers */
-  const rcti *mask = NULL;
+  bool use_mask;
+  rcti mask;
   if (region->runtime.category &&
       (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT)) {
-    rcti mask_buf;
-    UI_view2d_mask_from_win(v2d, &mask_buf);
-    mask_buf.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH;
-    mask = &mask_buf;
+    use_mask = true;
+    UI_view2d_mask_from_win(v2d, &mask);
+    mask.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH;
   }
-  UI_view2d_scrollers_draw(v2d, mask);
+  UI_view2d_scrollers_draw(v2d, use_mask ? &mask : NULL);
 }
 
 void ED_region_panels_ex(const bContext *C, ARegion *region, const char *contexts[])



More information about the Bf-blender-cvs mailing list