Fix T52415: Copy/Pasting a mesh immediately crashes blender

Since the paste object is pasted in the active collection, and not on
its original one, we need to flush/calculate the new collection base
settings (visibility, selectability, ...).

DEG_id_tag_update() for the scene now. Though it may be better to tag
only the object specific IDs in the future.
This commit is contained in:
Dalai Felinto 2017-08-16 12:14:31 +02:00
parent 2b95617b15
commit 6bca0dcf7b
Notes: blender-bot 2023-02-14 08:42:53 +01:00
Referenced by issue #52415, Copy/Pasting a mesh immediately crashes blender
1 changed files with 5 additions and 0 deletions

View File

@ -49,6 +49,7 @@
#include "BKE_main.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "BLO_readfile.h"
@ -160,6 +161,10 @@ bool BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, Re
/* recreate dependency graph to include new objects */
DEG_relations_tag_update(bmain);
/* Tag update the scene to flush base collection settings, since the new object is added to a
* new (active) collection, not its original collection, thus need recalculation. */
DEG_id_tag_update(&scene->id, 0);
BLO_blendhandle_close(bh);
/* remove library... */