From 60d733c5631666201393d950131581d22c4832ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Apr 2019 12:42:09 +0200 Subject: Fix/workaround crash using ED_area_do_msg_notify_tag_redraw Temporary workaround for crash when refreshing the active tool. Currently ED_region_tag_redraw fails, use notifiers until this is resolved. --- source/blender/editors/include/ED_screen.h | 3 --- source/blender/editors/screen/area.c | 34 +++++++++++++++++------------- 2 files changed, 19 insertions(+), 18 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index b4349ff6cc7..5d9c493737c 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -131,9 +131,6 @@ bool ED_region_snap_size_apply(struct ARegion *ar, int snap_flag); void ED_region_do_msg_notify_tag_redraw(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); -void ED_area_do_msg_notify_tag_redraw(struct bContext *C, - struct wmMsgSubscribeKey *msg_key, - struct wmMsgSubscribeValue *msg_val); void ED_area_do_msg_notify_tag_refresh(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 250a4171e8a..f0e8fb3fa2f 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -443,26 +443,28 @@ void ED_region_do_msg_notify_tag_redraw( } } } -/** - * Use #ED_region_do_msg_notify_tag_redraw where possible, this draws too much typically. - */ -void ED_area_do_msg_notify_tag_redraw( + +void ED_area_do_msg_notify_tag_refresh( /* Follow wmMsgNotifyFn spec */ bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) { - ScrArea *sa = msg_val->owner; - ED_area_tag_redraw(sa); + ScrArea *sa = msg_val->user_data; + ED_area_tag_refresh(sa); } -void ED_area_do_msg_notify_tag_refresh( + +static void region_do_msg_notify_tag_redraw( /* Follow wmMsgNotifyFn spec */ bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) { - ScrArea *sa = msg_val->user_data; - ED_area_tag_refresh(sa); + ARegion *ar = msg_val->owner; + ED_region_tag_redraw(ar); + + /* FIXME(campbell): shouldn't be needed. */ + WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL); } void ED_area_do_mgs_subscribe_for_tool_header( @@ -471,15 +473,17 @@ void ED_area_do_mgs_subscribe_for_tool_header( struct WorkSpace *workspace, struct Scene *UNUSED(scene), struct bScreen *UNUSED(screen), - struct ScrArea *sa, - struct ARegion *UNUSED(ar), + struct ScrArea *UNUSED(sa), + struct ARegion *ar, struct wmMsgBus *mbus) { - /* TODO(campbell): investigate why ED_region_do_msg_notify_tag_redraw doesn't work here. */ wmMsgSubscribeValue msg_sub_value_region_tag_redraw = { - .owner = sa, - .user_data = sa, - .notify = ED_area_do_msg_notify_tag_redraw, + .owner = ar, + .user_data = ar, + /* TODO(campbell): investigate why + * ED_region_do_msg_notify_tag_redraw doesn't work here. */ + // .notify = ED_region_do_msg_notify_tag_redraw, + .notify = region_do_msg_notify_tag_redraw, }; WM_msg_subscribe_rna_prop( mbus, &workspace->id, workspace, WorkSpace, tools, &msg_sub_value_region_tag_redraw); -- cgit v1.2.3