diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-06 06:59:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-06 07:24:16 +0300 |
commit | bc97d7832906318a1185b3fb460b1d8d89020ba0 (patch) | |
tree | 096969472b2a5ad82c56d8f616cd398f47840bdf /source/blender/editors/screen | |
parent | 99738fbfdc8b4639d95c796bcc8711bd89c1aaa4 (diff) |
Cleanup: use MEM_SAFE_FREE macro
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 10 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 15 |
3 files changed, 9 insertions, 26 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index c351ade9954..e08a4e946f6 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -834,9 +834,8 @@ void ED_area_status_text(ScrArea *area, const char *str) BLI_strncpy(region->headerstr, str, UI_MAX_DRAW_STR); BLI_str_rstrip(region->headerstr); } - else if (region->headerstr) { - MEM_freeN(region->headerstr); - region->headerstr = NULL; + else { + MEM_SAFE_FREE(region->headerstr); } ED_region_tag_redraw(region); } @@ -859,9 +858,8 @@ void ED_workspace_status_text(bContext *C, const char *str) } BLI_strncpy(workspace->status_text, str, UI_MAX_DRAW_STR); } - else if (workspace->status_text) { - MEM_freeN(workspace->status_text); - workspace->status_text = NULL; + else { + MEM_SAFE_FREE(workspace->status_text); } /* Redraw status bar. */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 2a81fcfde8f..506b5a9859d 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -722,10 +722,7 @@ void ED_region_exit(bContext *C, ARegion *region) WM_event_modal_handler_region_replace(win, region, NULL); WM_draw_region_free(region, true); - if (region->headerstr) { - MEM_freeN(region->headerstr); - region->headerstr = NULL; - } + MEM_SAFE_FREE(region->headerstr); if (region->regiontimer) { WM_event_remove_timer(wm, win, region->regiontimer); @@ -1653,10 +1650,7 @@ void ED_refresh_viewport_fps(bContext *C) } else { /* playback stopped or shouldn't be running */ - if (scene->fps_info) { - MEM_freeN(scene->fps_info); - } - scene->fps_info = NULL; + MEM_SAFE_FREE(scene->fps_info); } } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d8cef889a40..e150d7774f9 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1023,10 +1023,7 @@ AZone *ED_area_azones_update(ScrArea *area, const int xy[2]) static void actionzone_exit(wmOperator *op) { - if (op->customdata) { - MEM_freeN(op->customdata); - } - op->customdata = NULL; + MEM_SAFE_FREE(op->customdata); G.moving &= ~G_TRANSFORM_WM; } @@ -1308,10 +1305,7 @@ static bool area_swap_init(wmOperator *op, const wmEvent *event) static void area_swap_exit(bContext *C, wmOperator *op) { WM_cursor_modal_restore(CTX_wm_window(C)); - if (op->customdata) { - MEM_freeN(op->customdata); - } - op->customdata = NULL; + MEM_SAFE_FREE(op->customdata); } static void area_swap_cancel(bContext *C, wmOperator *op) @@ -1892,10 +1886,7 @@ static void area_move_apply(bContext *C, wmOperator *op) static void area_move_exit(bContext *C, wmOperator *op) { - if (op->customdata) { - MEM_freeN(op->customdata); - } - op->customdata = NULL; + MEM_SAFE_FREE(op->customdata); /* this makes sure aligned edges will result in aligned grabbing */ BKE_screen_remove_double_scrverts(CTX_wm_screen(C)); |