diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-11 12:50:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-11 13:04:34 +0300 |
commit | d96b141666c17ab2aaba750286b3affc9bef0288 (patch) | |
tree | a0db1dfb21d4de3383339422257605c82932ce4e /source/blender/editors/curve | |
parent | c27d00cde08ab32718af326f6b72ccfdf3ef073a (diff) |
Fix T79464: Crash adding objects without an active screen
Running add-objects operator without an active screen would crash
as CTX_data_edit_object would return NULL in this case.
This could happen when adding objects from frame-change handlers for e.g.
In the case of adding new objects there is no need for a context lookup,
pass this directly to ED_object_editmode_exit_ex.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/editcurve_add.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index 19b05f0af0c..4d72e90b89b 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -508,7 +508,10 @@ Nurb *ED_curve_add_nurbs_primitive( static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) { - Object *obedit = CTX_data_edit_object(C); + struct Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); ListBase *editnurb; Nurb *nu; bool newob = false; @@ -565,7 +568,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) /* userdef */ if (newob && !enter_editmode) { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA); } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); |