[Bf-blender-cvs] [315210c22ba] master: XR: Fix crash on executing some action operators

Peter Kim noreply at git.blender.org
Fri Mar 25 05:22:31 CET 2022


Commit: 315210c22baea5e0da06cac7fee4c24a4b7d887f
Author: Peter Kim
Date:   Fri Mar 25 13:22:04 2022 +0900
Branches: master
https://developer.blender.org/rB315210c22baea5e0da06cac7fee4c24a4b7d887f

XR: Fix crash on executing some action operators

Since the XR area does not have any region geometry, hud updates from
operators would cause invalid access when updating region sizes.

===================================================================

M	source/blender/editors/screen/area.c
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/windowmanager/intern/wm_event_system.c

===================================================================

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index af84f6f99a9..30bf23e0987 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1972,6 +1972,7 @@ void ED_area_init(wmWindowManager *wm, wmWindow *win, ScrArea *area)
 
 static void area_offscreen_init(ScrArea *area)
 {
+  area->flag |= AREA_FLAG_OFFSCREEN;
   area->type = BKE_spacetype_from_id(area->spacetype);
 
   if (area->type == NULL) {
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index c8209b4d194..d32757cc868 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -540,6 +540,8 @@ enum {
   AREA_FLAG_STACKED_FULLSCREEN = (1 << 7),
   /** Update action zones (even if the mouse is not intersecting them). */
   AREA_FLAG_ACTIONZONES_UPDATE = (1 << 8),
+  /** For offscreen areas. */
+  AREA_FLAG_OFFSCREEN = (1 << 9),
 };
 
 #define AREAGRID 4
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 790b08437bd..60ae4eccbbe 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1063,7 +1063,7 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat,
   if (hud_status != NOP) {
     if (hud_status == SET) {
       ScrArea *area = CTX_wm_area(C);
-      if (area) {
+      if (area && ((area->flag & AREA_FLAG_OFFSCREEN) == 0)) {
         ED_area_type_hud_ensure(C, area);
       }
     }



More information about the Bf-blender-cvs mailing list