Fix #109887: Adding driver from python might crash
Originally was noticed when adding drivers to a rigid body., but it could potentially happen with any configuration. The reason for the crash was that the ID which was modified was not tagged as such. Modifying drivers from the interface are likely tagging for updates from the operator. This change makes it so the python function also does tagging. It is not really how one would design the system nowadays, but it is how the Blender historically handles such cases. A bigger refactor is possible to move tags to the places where modification actually happens, but it seems to be a better idea to tackle it as a separate project which will be considered no-functional-changes. Pull Request: https://projects.blender.org/blender/blender/pulls/109895
This commit is contained in:
committed by
Sergey Sharybin
parent
998e7f644f
commit
9314f97afd
@@ -47,6 +47,7 @@
|
||||
#include "../generic/py_capi_rna.h"
|
||||
#include "../generic/python_utildefines.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
||||
/* for keyframes and drivers */
|
||||
@@ -588,6 +589,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
|
||||
|
||||
bContext *context = BPY_context_get();
|
||||
WM_event_add_notifier(BPY_context_get(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
|
||||
DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);
|
||||
DEG_relations_tag_update(CTX_data_main(context));
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user