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.
This commit is contained in:
Harley Acheson 2022-01-11 10:01:14 +01:00 committed by Philipp Oeser
parent b2e15cb19d
commit 08226693cf
Notes: blender-bot 2023-02-14 10:21:11 +01:00
Referenced by issue #94334, Close Area crashes Blender (3.0.0 and 3.0.1)
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
1 changed files with 4 additions and 0 deletions

View File

@ -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 */