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.
This commit is contained in:
Hans Goudey 2020-10-18 22:18:31 -05:00
parent 48c484a22e
commit 94364be80a
1 changed files with 6 additions and 6 deletions

View File

@ -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[])