Page MenuHome

Fix T72200: Split Quad View Region Crash

Authored by Jeroen Bakker (jbakker) on Tue, Jan 14, 12:24 PM.



When splitting a Quad View by dragging a corner an quad area can become
negative size because of a one pixel offset to calculate the start of
the area.

This patch solves this to make sure that there are no negative areas. By
adapting the ARegion.winrct.

Diff Detail

rB Blender

Event Timeline

The previous patch had 2 fixes. I cleaned up this patch to contain only one.


Nitpicking here :) :
While this fixes this specific issue, the fix will break when max values end up being negative. E.g. because we change the 1px offset to be subtracted rather than added.
So I'd prefer to properly sanitize the rectangle, making sure min values are less then or equal to max values.

We could add a BLI_rcti_sanitize(), but BLI_rcti_init() already has this logic.

So I'd propose this instead:

1diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
2index 98bee156090..eb49177cc08 100644
3--- a/source/blender/editors/screen/area.c
4+++ b/source/blender/editors/screen/area.c
5@@ -1437,6 +1437,11 @@ static void region_rect_recursive(
6 BLI_rcti_init(remainder, 0, 0, 0, 0);
7 }
9+ /* Fix any negative dimensions. This can happen when a quad split 3d view gets to small (see
10+ * T72200). BLI_rcti_init() sanitizes, making sure min values are <= max values. */
11+ BLI_rcti_init(
12+ &ar->winrct, ar->winrct.xmin, ar->winrct.xmax, ar->winrct.ymin, ar->winrct.ymax);
14 quad++;
15 }
16 }

Jeroen Bakker (jbakker) marked an inline comment as done.

Use BLI_rcti_init for sanitization

This revision is now accepted and ready to land.Tue, Jan 14, 3:58 PM
This revision was automatically updated to reflect the committed changes.