[Bf-blender-cvs] [08226693cfa] blender-v3.0-release: Fix T94334: 3DView View Menu Close Error

Harley Acheson noreply at git.blender.org
Tue Jan 11 10:38:37 CET 2022


Commit: 08226693cfa2b18a89af91d6c3488d92820fed35
Author: Harley Acheson
Date:   Tue Jan 11 10:01:14 2022 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rB08226693cfa2b18a89af91d6c3488d92820fed35

Fix T94334: 3DView View Menu Close Error

Add Error checking to `do_view3d_header_buttons` so that it does
not crash if area->win does not exist because it has been closed.

Note this is a temporary simple fix that will be replaced by D13660.

---

Selecting "Close Area" from the 3DView View / Area menu will crash when `do_view3d_header_buttons` is called afterward even though the area has closed. It gets a NULL result from CTX_wm_window(C) and dies. This patch just adds a check for this being NULL and exits out in this case.

`uiTemplateEditModeSelection` is a bit dodgy adding `do_view3d_header_buttons` as a handler for the entire uiBlock. This patch is meant to be a simple and temporary solution in 3.01, replaced later by {D13660} which fixes this area by using an operator instead.

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

M	source/blender/editors/space_view3d/view3d_header.c

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

diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 607ca110d0f..ed9722ba9af 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -101,6 +101,10 @@ void VIEW3D_OT_toggle_matcap_flip(wmOperatorType *ot)
 static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
 {
   wmWindow *win = CTX_wm_window(C);
+  if (!win) {
+    return;
+  }
+
   const int ctrl = win->eventstate->ctrl, shift = win->eventstate->shift;
 
   /* watch it: if area->win does not exist, check that when calling direct drawing routines */



More information about the Bf-blender-cvs mailing list