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:
authorJulian Eisel <eiseljulian@gmail.com>2017-06-09 18:16:39 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-06-09 18:17:28 +0300
commit2bb004e03d11e7d7a0f930ecad66c1d3b744eb39 (patch)
treebb5ca923e1a5b6f88ceec1dd131b01925dcb6ff1 /source/blender/blenkernel
parentf35df9a25adec35a384ba45c5b2b2d5767e7e87d (diff)
Fix crash when deleting active workspace render-layer
Also fixes some failing unit-tests for render-layers.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_layer.h2
-rw-r--r--source/blender/blenkernel/intern/layer.c35
-rw-r--r--source/blender/blenkernel/intern/scene.c6
3 files changed, 7 insertions, 36 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index 17ab0bf0d2b..578cc97466a 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -64,8 +64,6 @@ struct SceneLayer *BKE_scene_layer_context_active_ex(const struct Main *bmain, c
struct SceneLayer *BKE_scene_layer_context_active(const struct Scene *scene);
struct SceneLayer *BKE_scene_layer_add(struct Scene *scene, const char *name);
-bool BKE_scene_layer_remove(struct Main *bmain, struct Scene *scene, struct SceneLayer *sl);
-
void BKE_scene_layer_free(struct SceneLayer *sl);
void BKE_scene_layer_engine_set(struct SceneLayer *sl, const char *engine);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index b088c7b4745..d600f753d75 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -128,39 +128,8 @@ SceneLayer *BKE_scene_layer_add(Scene *scene, const char *name)
return sl;
}
-bool BKE_scene_layer_remove(Main *bmain, Scene *scene, SceneLayer *sl)
-{
- const int act = BLI_findindex(&scene->render_layers, sl);
-
- if (act == -1) {
- return false;
- }
- else if ( (scene->render_layers.first == scene->render_layers.last) &&
- (scene->render_layers.first == sl))
- {
- /* ensure 1 layer is kept */
- return false;
- }
-
- BLI_remlink(&scene->render_layers, sl);
-
- BKE_scene_layer_free(sl);
- MEM_freeN(sl);
-
- scene->active_layer = 0;
- /* TODO WORKSPACE: set active_layer to 0 */
-
- for (Scene *sce = bmain->scene.first; sce; sce = sce->id.next) {
- if (sce->nodetree) {
- BKE_nodetree_remove_layer_n(sce->nodetree, scene, act);
- }
- }
-
- return true;
-}
-
/**
- * Free (or release) any data used by this SceneLayer (does not free the SceneLayer itself).
+ * Free (or release) any data used by this SceneLayer.
*/
void BKE_scene_layer_free(SceneLayer *sl)
{
@@ -200,6 +169,8 @@ void BKE_scene_layer_free(SceneLayer *sl)
BLI_freelistN(&sl->drawdata);
MEM_SAFE_FREE(sl->stats);
+
+ MEM_freeN(sl);
}
/**
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 2f7c9db2de1..fbb24a8ccb5 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -581,10 +581,12 @@ void BKE_scene_free(Scene *sce)
BKE_previewimg_free(&sce->preview);
curvemapping_free_data(&sce->r.mblur_shutter_curve);
- for (SceneLayer *sl = sce->render_layers.first; sl; sl = sl->next) {
+ for (SceneLayer *sl = sce->render_layers.first, *sl_next; sl; sl = sl_next) {
+ sl_next = sl->next;
+
+ BLI_remlink(&sce->render_layers, sl);
BKE_scene_layer_free(sl);
}
- BLI_freelistN(&sce->render_layers);
/* Master Collection */
BKE_collection_master_free(sce);