Fix T66366: Multi object edit makes blender crash

Two issues here:

- Evaluated object data is to only be updated for selection only after modifier
  stack is done its job. Otherwise it's possible to have selection batch update
  called on an input data, at the same time as original object data is being
  evaluated.

- If object's modifier stack did not create its own evaluated mesh (in case
  when there is no effective modifiers, for example) can not update selection
  on object's data, as it might cause threading issues between objects sharing
  same data.
This commit is contained in:
Sergey Sharybin 2019-07-03 11:52:56 +02:00
parent 055289a95f
commit f990c23bcf
Notes: blender-bot 2023-02-14 10:29:30 +01:00
Referenced by issue #66366, multi object edit makes blender crash
Referenced by issue #66374, crash when adding non-mesh object
2 changed files with 13 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_threads.h"
#include "BLI_math.h"
#include "BKE_animsys.h"
@ -396,7 +397,16 @@ void BKE_object_data_select_update(Depsgraph *depsgraph, ID *object_data)
void BKE_object_select_update(Depsgraph *depsgraph, Object *object)
{
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
BKE_object_data_select_update(depsgraph, object->data);
if (!object->runtime.is_mesh_eval_owned) {
Mesh *mesh_input = object->runtime.mesh_orig;
Mesh_Runtime *mesh_runtime = &mesh_input->runtime;
BLI_mutex_lock(mesh_runtime->eval_mutex);
BKE_object_data_select_update(depsgraph, object->data);
BLI_mutex_unlock(mesh_runtime->eval_mutex);
}
else {
BKE_object_data_select_update(depsgraph, object->data);
}
}
void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph,

View File

@ -1998,6 +1998,8 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
OperationKey object_select_key(
&object->id, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE);
add_relation(object_data_select_key, object_select_key, "Data Selection -> Object Selection");
add_relation(
geom_key, object_select_key, "Object Geometry -> Select Update", RELATION_FLAG_NO_FLUSH);
}
void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)