diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-05-25 12:58:08 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-06-10 19:46:41 +0300 |
commit | 20658e6a29bd33264d99fcee9cea1886d1c9d0c9 (patch) | |
tree | f04ec62e517adea8935d36994d8017d074efdbe9 /source/blender/editors/sculpt_paint | |
parent | 4b39de677d206afb99360665207498bb74c90893 (diff) |
Fix T77047: Dyntopo Sample detail size on hidden mesh causes crash
The `Toolbar` and `Sidebar` hide the corresponding panel
`VIEW3D_PT_sculpt_dyntopo` by polling for context.sculpt_object and
context.tool_settings.sculpt. In the Active Tool in the Properties
Editor this poll does not return False though, thus the
sample_detail_size is possible from there.
Second security check (the operator poll `SCULPT_mode_poll`) checks the
active object -- that is still valid even if hidden, so we are allowed
to execute the operator. However the active object becomes NULL once the
area is switched in `sample_detail()` -- see `CTX_wm_area_set`), leading
to the crash.
Dont think there is a quick and easy way to do this in the poll from the
Properties Editor, so just check for a valid active abject in the
operator and return OPERATOR_CANCELLED if we dont have it.
Maniphest Tasks: T77047
Differential Revision: https://developer.blender.org/D7832
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_detail.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c index b7d1cd8c005..f071deaa219 100644 --- a/source/blender/editors/sculpt_paint/sculpt_detail.c +++ b/source/blender/editors/sculpt_paint/sculpt_detail.c @@ -259,8 +259,11 @@ static int sample_detail(bContext *C, int mx, int my, int mode) ED_view3d_viewcontext_init(C, &vc, depsgraph); Object *ob = vc.obact; - SculptSession *ss = ob->sculpt; + if (ob == NULL) { + return OPERATOR_CANCELLED; + } + SculptSession *ss = ob->sculpt; if (!ss->pbvh) { return OPERATOR_CANCELLED; } |