Event Timeline
Comment Actions
*Edited* - setting: ar = sa->regionbase.last; crashes for me in region_quadview_exec
The crash is caused by CTX_wm_region being left with a freed ar pointer. easy enough to solve.
Comment Actions
Attached an alternate fix, which should help with other areas too.
This makes it so the unlocked (user) view is selected first.
I don't especially like adding this extra complexity into BKE_area_find_region_type but it has the advantage that other operators will find the user view first.
We could also check on making it so the user view is inserted and found first.
ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
{
ARegion *ar = NULL;
if (sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == type) {
break;
}
}
}
if (sa->spacetype == SPACE_VIEW3D) {
if (ar && (type == RGN_TYPE_WINDOW) && (ar->alignment == RGN_ALIGN_QSPLIT)) {
ARegion *ar_fallback = ar;
ar = ar->next;
while (ar) {
if (ar->regiontype == type) {
RegionView3D *rv3d = ar->regiondata;
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
break;
}
}
ar = ar->next;
}
if (ar == NULL) {
ar = ar_fallback;
}
}
}
return ar;
}