Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-12-14 14:20:56 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-12-14 14:20:56 +0300
commit0e76ff18b5bac34fb7f3b96c4849024ec9b2c2fb (patch)
treec6855aa3a1459c9106d3028c462d5facc802ef59 /source/blender
parentdc4c1be1a4455e84d1f72ce2703ab7425152965c (diff)
Fix T58351: Make Single User crashes
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_layer.h8
-rw-r--r--source/blender/editors/object/object_relations.c22
2 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index db363148bc8..2abdaf103f9 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -301,17 +301,21 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
} \
} ((void)0)
-#define FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, _instance) \
+#define FOREACH_OBJECT_FLAG_BEGIN(scene, _view_layer, _v3d, flag, _instance) \
{ \
IteratorBeginCb func_begin; \
IteratorCb func_next, func_end; \
void *data_in; \
+ struct ObjectsVisibleIteratorData data_ = { \
+ .view_layer = _view_layer, \
+ .v3d = _v3d, \
+ }; \
\
if (flag == SELECT) { \
func_begin = &BKE_view_layer_selected_objects_iterator_begin; \
func_next = &BKE_view_layer_selected_objects_iterator_next; \
func_end = &BKE_view_layer_selected_objects_iterator_end; \
- data_in = (view_layer); \
+ data_in = &data_; \
} \
else { \
func_begin = BKE_scene_objects_iterator_begin; \
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index ead000819b7..d61c5334ee6 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1754,7 +1754,7 @@ static void new_id_matar(Main *bmain, Material **matar, const int totcol)
}
}
-static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag)
+static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag)
{
Lamp *la;
Curve *cu;
@@ -1763,7 +1763,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
Lattice *lat;
ID *id;
- FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
+ FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, v3d, flag, ob)
{
if (!ID_IS_LINKED(ob)) {
id = ob->data;
@@ -1844,9 +1844,9 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
}
}
-static void single_object_action_users(Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag)
+static void single_object_action_users(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag)
{
- FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
+ FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, v3d, flag, ob)
{
if (!ID_IS_LINKED(ob)) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -1856,12 +1856,12 @@ static void single_object_action_users(Main *bmain, Scene *scene, ViewLayer *vie
FOREACH_OBJECT_FLAG_END;
}
-static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag)
+static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag)
{
Material *ma, *man;
int a;
- FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
+ FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, v3d, flag, ob)
{
if (!ID_IS_LINKED(ob)) {
for (a = 1; a <= ob->totcol; a++) {
@@ -1919,8 +1919,8 @@ void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bo
single_object_users(bmain, scene, NULL, 0, copy_collections);
if (full) {
- single_obdata_users(bmain, scene, NULL, 0);
- single_object_action_users(bmain, scene, NULL, 0);
+ single_obdata_users(bmain, scene, NULL, NULL, 0);
+ single_object_action_users(bmain, scene, NULL, NULL, 0);
single_mat_users_expand(bmain);
}
@@ -2456,15 +2456,15 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
}
if (RNA_boolean_get(op->ptr, "obdata")) {
- single_obdata_users(bmain, scene, view_layer, flag);
+ single_obdata_users(bmain, scene, view_layer, v3d, flag);
}
if (RNA_boolean_get(op->ptr, "material")) {
- single_mat_users(bmain, scene, view_layer, flag);
+ single_mat_users(bmain, scene, view_layer, v3d, flag);
}
if (RNA_boolean_get(op->ptr, "animation")) {
- single_object_action_users(bmain, scene, view_layer, flag);
+ single_object_action_users(bmain, scene, view_layer, v3d, flag);
}
BKE_main_id_clear_newpoins(bmain);