diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-19 06:18:31 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-19 06:18:31 +0300 |
commit | 94364be80adcc5432112f96ddc06528161a1ad43 (patch) | |
tree | 0bf18b402e98665ab5bd81a2c0e9c1c7433dea79 | |
parent | 48c484a22e0d105ed21a4f18b0cb455af6aac661 (diff) |
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.
-rw-r--r-- | source/blender/editors/screen/area.c | 12 |
1 files changed, 6 insertions, 6 deletions
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[]) |