Fix #134162: Crash when opening a file with a compositor image node.
Yet another remaining case of non-trivial data created with C-style allocation. While 4.4 and previous did not exhibit the crash, the invalid code responsible for this crash is present here as well, and it would be dangerous not to fix it.
This commit is contained in:
@@ -27,7 +27,7 @@ struct bContext;
|
||||
#define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y
|
||||
|
||||
struct RNAUpdateCb {
|
||||
PointerRNA ptr;
|
||||
PointerRNA ptr = {};
|
||||
PropertyRNA *prop;
|
||||
};
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout,
|
||||
}
|
||||
|
||||
struct RNAUpdateCb {
|
||||
PointerRNA ptr;
|
||||
PointerRNA ptr = {};
|
||||
PropertyRNA *prop;
|
||||
ImageUser *iuser;
|
||||
};
|
||||
@@ -789,11 +789,16 @@ void uiTemplateImage(uiLayout *layout,
|
||||
}
|
||||
|
||||
/* Set custom callback for property updates. */
|
||||
RNAUpdateCb *cb = static_cast<RNAUpdateCb *>(MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb"));
|
||||
RNAUpdateCb *cb = MEM_new<RNAUpdateCb>(__func__);
|
||||
cb->ptr = *ptr;
|
||||
cb->prop = prop;
|
||||
cb->iuser = iuser;
|
||||
UI_block_funcN_set(block, rna_update_cb, cb, nullptr);
|
||||
UI_block_funcN_set(block,
|
||||
rna_update_cb,
|
||||
cb,
|
||||
nullptr,
|
||||
but_func_argN_free<RNAUpdateCb>,
|
||||
but_func_argN_copy<RNAUpdateCb>);
|
||||
|
||||
/* Disable editing if image was modified, to avoid losing changes. */
|
||||
const bool is_dirty = BKE_image_is_dirty(ima);
|
||||
|
||||
Reference in New Issue
Block a user