Fix #137998: Crash calling editmode_toggle overriding view_layer.objects.active
If the viewlayer active object was set to None, editmode toggle poll would still be permissive (it checked `CTX_data_active_object`, exec was checking `BKE_view_layer_active_object_get`...) These two need to be in sync. For this PR, just go with `BKE_view_layer_active_object_get`... NOTE: other mode switching operators seem to have the same "problem". Pull Request: https://projects.blender.org/blender/blender/pulls/138083
This commit is contained in:
committed by
Philipp Oeser
parent
1ae6d13b5f
commit
8409a5081b
@@ -1003,7 +1003,11 @@ static wmOperatorStatus editmode_toggle_exec(bContext *C, wmOperator *op)
|
||||
|
||||
static bool editmode_toggle_poll(bContext *C)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
/* Get object the same way as in editmode_toggle_exec(). Otherwise overriding context can crash,
|
||||
* see #137998. */
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
BKE_view_layer_synced_ensure(CTX_data_scene(C), view_layer);
|
||||
Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
|
||||
/* Covers liboverrides too. */
|
||||
if (ELEM(nullptr, ob, ob->data) || !ID_IS_EDITABLE(ob->data) || ID_IS_OVERRIDE_LIBRARY(ob) ||
|
||||
|
||||
Reference in New Issue
Block a user