Fix T63255: Crash when circle select performs selection outside the viewport's bounds.
This commit is contained in:
parent
ef91df608a
commit
3464a53477
Notes:
blender-bot
2023-02-14 08:06:33 +01:00
Referenced by issue #63255, crash while staying in circle select mode and clicking in another editor
|
@ -2561,13 +2561,21 @@ void DRW_framebuffer_select_id_read(const rcti *rect, uint *r_buf)
|
|||
};
|
||||
|
||||
rcti rect_clamp = *rect;
|
||||
BLI_rcti_isect(&r, rect, &rect_clamp);
|
||||
if (BLI_rcti_isect(&r, &rect_clamp, &rect_clamp)) {
|
||||
GPU_texture_read_rect(
|
||||
g_select_buffer.texture_u32,
|
||||
GPU_DATA_UNSIGNED_INT, &rect_clamp, r_buf);
|
||||
|
||||
GPU_texture_read_rect(
|
||||
g_select_buffer.texture_u32, GPU_DATA_UNSIGNED_INT, &rect_clamp, r_buf);
|
||||
if (!BLI_rcti_compare(rect, &rect_clamp)) {
|
||||
GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf);
|
||||
}
|
||||
}
|
||||
else {
|
||||
size_t buf_size = BLI_rcti_size_x(rect) *
|
||||
BLI_rcti_size_y(rect) *
|
||||
sizeof(*r_buf);
|
||||
|
||||
if (!BLI_rcti_compare(rect, &rect_clamp)) {
|
||||
GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf);
|
||||
memset(r_buf, 0, buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue