Fix another batch of mismatches MEM_new/MEM_freeN cases in UI/Assets code.

This commit is contained in:
Bastien Montagne
2024-06-27 14:50:35 +02:00
parent 643334b727
commit adfe688046
5 changed files with 9 additions and 6 deletions

View File

@@ -2152,7 +2152,7 @@ void ui_panel_drag_collapse_handler_add(const bContext *C, const bool was_open)
{
wmWindow *win = CTX_wm_window(C);
const wmEvent *event = win->eventstate;
uiPanelDragCollapseHandle *dragcol_data = MEM_new<uiPanelDragCollapseHandle>(__func__);
uiPanelDragCollapseHandle *dragcol_data = MEM_cnew<uiPanelDragCollapseHandle>(__func__);
dragcol_data->was_first_open = was_open;
copy_v2_v2_int(dragcol_data->xy_init, event->xy);

View File

@@ -98,7 +98,7 @@ void ui_textedit_undo_push(uiUndoStack_Text *stack, const char *text, int cursor
uiUndoStack_Text *ui_textedit_undo_stack_create()
{
uiUndoStack_Text *stack = MEM_new<uiUndoStack_Text>(__func__);
uiUndoStack_Text *stack = MEM_cnew<uiUndoStack_Text>(__func__);
stack->current = nullptr;
BLI_listbase_clear(&stack->states);

View File

@@ -1661,7 +1661,7 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry
filelist_cache_preview_ensure_running(cache);
entry->flags |= FILE_ENTRY_PREVIEW_LOADING;
FileListEntryPreview *preview = MEM_new<FileListEntryPreview>(__func__);
FileListEntryPreview *preview = MEM_cnew<FileListEntryPreview>(__func__);
preview->index = index;
preview->flags = entry->typeflag;
preview->icon_id = 0;
@@ -1685,7 +1685,7 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry
}
// printf("%s: %d - %s\n", __func__, preview->index, preview->filepath);
FileListEntryPreviewTaskData *preview_taskdata = MEM_new<FileListEntryPreviewTaskData>(
FileListEntryPreviewTaskData *preview_taskdata = MEM_cnew<FileListEntryPreviewTaskData>(
__func__);
preview_taskdata->preview = preview;
BLI_task_pool_push(cache->previews_pool,

View File

@@ -2983,7 +2983,7 @@ static bool ed_object_select_pick(bContext *C,
}
if (gpu != nullptr) {
MEM_freeN(gpu);
MEM_delete(gpu);
}
return (changed_object || changed_pose || changed_track);

View File

@@ -656,7 +656,10 @@ wmDragAsset *WM_drag_create_asset_data(const blender::asset_system::AssetReprese
static void wm_drag_free_asset_data(wmDragAsset **asset_data)
{
MEM_SAFE_FREE(*asset_data);
if (*asset_data) {
MEM_delete(*asset_data);
*asset_data = nullptr;
}
}
wmDragAsset *WM_drag_get_asset_data(const wmDrag *drag, int idcode)