Fix T65002: after hiding edit mode object, clicking in wireframe mode crashes

Differential Revision: https://developer.blender.org/D4926
This commit is contained in:
George Vogiatzis 2019-05-23 13:57:03 +02:00 committed by Brecht Van Lommel
parent df7f69b873
commit 352474ced8
Notes: blender-bot 2023-02-14 09:43:37 +01:00
Referenced by issue #65002, crash: clicking in edit mode after wireframe object is disabled in viewport
1 changed files with 16 additions and 4 deletions

View File

@ -279,7 +279,7 @@ BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context *sel_id_ctx,
const uint sel_id,
uint *r_base_index)
{
char elem_type;
char elem_type = 0;
uint elem_id;
uint base_index = 0;
for (; base_index < sel_id_ctx->bases_len; base_index++) {
@ -504,7 +504,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
}
else {
struct NearestVertUserData data = {{0}};
const struct NearestVertUserData_Hit *hit;
const struct NearestVertUserData_Hit *hit = NULL;
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT;
BMesh *prev_select_bm = NULL;
@ -549,6 +549,10 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
}
}
if (hit == NULL) {
return NULL;
}
prev_select.index = hit->index;
prev_select.elem = hit->vert;
prev_select.bm = prev_select_bm;
@ -751,7 +755,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
}
else {
struct NearestEdgeUserData data = {{0}};
const struct NearestEdgeUserData_Hit *hit;
const struct NearestEdgeUserData_Hit *hit = NULL;
/* interpolate along the edge before doing a clipping plane test */
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB;
BMesh *prev_select_bm = NULL;
@ -798,6 +802,10 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
}
}
if (hit == NULL) {
return NULL;
}
if (r_dist_center) {
*r_dist_center = hit->dist_center;
}
@ -960,7 +968,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
}
else {
struct NearestFaceUserData data = {{0}};
const struct NearestFaceUserData_Hit *hit;
const struct NearestFaceUserData_Hit *hit = NULL;
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT;
BMesh *prev_select_bm = NULL;
@ -1005,6 +1013,10 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
}
}
if (hit == NULL) {
return NULL;
}
if (r_dist_center) {
*r_dist_center = hit->dist;
}