diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-22 18:55:39 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-22 18:55:39 +0400 |
commit | 232da3741e2c48f06a51aff7469d90e29e5e52ed (patch) | |
tree | 20c8e5ee831e54eebebb1a7661d3cec7ea60c5bb /source | |
parent | a20bcb4613d5f2f9b47a37c731f70c30c6175756 (diff) |
Fix #28593: F6 operator redo could crash when editing buttons that use unit
settings, these could get freed with the scene on undo/redo, make a copy now.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7dac8c6351a..32fe0fb86f9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1935,6 +1935,9 @@ void uiFreeBlock(const bContext *C, uiBlock *block) ui_free_but(C, but); } + if(block->unit) + MEM_freeN(block->unit); + if(block->func_argN) MEM_freeN(block->func_argN); @@ -2010,10 +2013,15 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor block->active= 1; block->dt= dt; block->evil_C= (void*)C; // XXX + if (scn) { block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); - block->unit= &scn->unit; + + /* copy to avoid crash when scene gets deleted with ui still open */ + block->unit= MEM_mallocN(sizeof(scn->unit), "UI UnitSettings"); + memcpy(block->unit, &scn->unit, sizeof(scn->unit)); } + BLI_strncpy(block->name, name, sizeof(block->name)); if(region) |