[Bf-blender-cvs] [d67c86d42a5] blender2.8: Revert "Fix T56418: Changing to Solid View crashes Blender"
Clément Foucault
noreply at git.blender.org
Wed Aug 22 13:51:25 CEST 2018
Commit: d67c86d42a5c563c939fbc5b5df66751ae6023e4
Author: Clément Foucault
Date: Wed Aug 22 13:07:15 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd67c86d42a5c563c939fbc5b5df66751ae6023e4
Revert "Fix T56418: Changing to Solid View crashes Blender"
This reverts commit 1e26345a89afd24ada035af133a9d5b5ba1ac278.
===================================================================
M source/blender/draw/intern/draw_manager.c
===================================================================
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 85fc11c85b0..57ddaa1e16f 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -837,7 +837,23 @@ DrawData *DRW_drawdata_ensure(
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
/* Allocate new data. */
- dd = MEM_callocN(size, "DrawData");
+ if ((GS(id->name) == ID_OB) && (((Object *)id)->base_flag & BASE_FROMDUPLI) != 0) {
+ /* NOTE: data is not persistent in this case. It is reset each redraw. */
+ BLI_assert(free_cb == NULL); /* No callback allowed. */
+ /* Round to sizeof(float) for DRW_instance_data_request(). */
+ const size_t t = sizeof(float) - 1;
+ size = (size + t) & ~t;
+ size_t fsize = size / sizeof(float);
+ BLI_assert(fsize < MAX_INSTANCE_DATA_SIZE);
+ if (DST.object_instance_data[fsize] == NULL) {
+ DST.object_instance_data[fsize] = DRW_instance_data_request(DST.idatalist, fsize);
+ }
+ dd = (DrawData *)DRW_instance_data_next(DST.object_instance_data[fsize]);
+ memset(dd, 0, size);
+ }
+ else {
+ dd = MEM_callocN(size, "DrawData");
+ }
dd->engine_type = engine_type;
dd->free = free_cb;
/* Perform user-side initialization, if needed. */
More information about the Bf-blender-cvs
mailing list