From fc8a7a44b200e37066a8753c514564c674eace30 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 10 Jun 2020 17:50:11 +1000 Subject: Fix T77560: Bone selection crashes The was caused by 8b347fc2cdc67 as the old BONESEL_NOSEL flag handled the -1 case (used for none). Instead of checking for -1, remove these elements from the array as selection code makes decisions based on the number of hits detected. --- source/blender/editors/space_view3d/view3d_view.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/blender/editors/space_view3d') diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index fe77ca05a04..3fc990160d2 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1192,6 +1192,24 @@ finally: return hits; } +int view3d_opengl_select_with_id_filter(ViewContext *vc, + uint *buffer, + uint bufsize, + const rcti *input, + eV3DSelectMode select_mode, + eV3DSelectObjectFilter select_filter, + uint select_id) +{ + int hits = view3d_opengl_select(vc, buffer, bufsize, input, select_mode, select_filter); + + /* Selection sometimes uses -1 for an invalid selection ID, remove these as they + * interfere with detection of actual number of hits in the selection. */ + if (hits > 0) { + hits = GPU_select_buffer_remove_by_id(buffer, hits, select_id); + } + return hits; +} + /** \} */ /* -------------------------------------------------------------------- */ -- cgit v1.2.3