Fix: MEM_new/MEM_freeN mismatch in node editor

We can't use C++ non-trivial allocation for DNA data unfortunately
because the read file system uses c-style allocation with raw bytes
when reading files.

Pull Request: https://projects.blender.org/blender/blender/pulls/124180
This commit is contained in:
Hans Goudey 2024-07-04 18:27:47 +02:00 committed by Hans Goudey
parent e466c5315d
commit 83d34acc1f
2 changed files with 4 additions and 2 deletions

@ -1716,7 +1716,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator * /*op*/, const wmEv
if (step >= 1.0f) {
v2d->cur = sms->new_cur;
MEM_freeN(v2d->sms);
MEM_delete(v2d->sms);
v2d->sms = nullptr;
WM_event_timer_remove(CTX_wm_manager(C), win, v2d->smooth_timer);

@ -1212,7 +1212,9 @@ static void add_dragged_links_to_tree(bContext &C, bNodeLinkDrag &nldrag)
}
/* Before actually adding the link let nodes perform special link insertion handling. */
bNodeLink *new_link = MEM_new<bNodeLink>(__func__, link);
bNodeLink *new_link = static_cast<bNodeLink *>(MEM_mallocN(sizeof(bNodeLink), __func__));
*new_link = link;
if (link.fromnode->typeinfo->insert_link) {
if (!link.fromnode->typeinfo->insert_link(&ntree, link.fromnode, new_link)) {
MEM_freeN(new_link);