Fix/workaround crash using ED_area_do_msg_notify_tag_redraw
authorCampbell Barton <ideasman42@gmail.com>
Fri, 19 Apr 2019 10:42:09 +0000 (12:42 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 19 Apr 2019 10:44:28 +0000 (12:44 +0200)
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
source/blender/editors/screen/area.c

index b4349ff..5d9c493 100644 (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);
index 250a417..f0e8fb3 100644 (file)
@@ -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);