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.
This commit is contained in:
Campbell Barton 2019-04-19 12:42:09 +02:00
parent 98e2713e94
commit 60d733c563
2 changed files with 22 additions and 21 deletions

View File

@ -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);

View File

@ -443,18 +443,7 @@ 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(
/* Follow wmMsgNotifyFn spec */
bContext *UNUSED(C),
wmMsgSubscribeKey *UNUSED(msg_key),
wmMsgSubscribeValue *msg_val)
{
ScrArea *sa = msg_val->owner;
ED_area_tag_redraw(sa);
}
void ED_area_do_msg_notify_tag_refresh(
/* Follow wmMsgNotifyFn spec */
bContext *UNUSED(C),
@ -465,21 +454,36 @@ void ED_area_do_msg_notify_tag_refresh(
ED_area_tag_refresh(sa);
}
static void region_do_msg_notify_tag_redraw(
/* Follow wmMsgNotifyFn spec */
bContext *UNUSED(C),
wmMsgSubscribeKey *UNUSED(msg_key),
wmMsgSubscribeValue *msg_val)
{
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(
/* Follow ARegionType.message_subscribe */
const struct bContext *UNUSED(C),
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);