[Bf-blender-cvs] [11b994e26e4] master: Fix T67671: Blender crashes when resizing sidebar with a colorbamp

mano-wii noreply at git.blender.org
Fri Jul 26 13:31:11 CEST 2019


Commit: 11b994e26e4dbfc40dc6ff2194b7855e2eb20f23
Author: mano-wii
Date:   Thu Jul 25 17:06:53 2019 -0300
Branches: master
https://developer.blender.org/rB11b994e26e4dbfc40dc6ff2194b7855e2eb20f23

Fix T67671: Blender crashes when resizing sidebar with a colorbamp

The amount of triangles drawn by the button depends on its `sizex`.
See:
```
immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2);
```
Therefore the `sizex` cannot be 0.

Solution a bit similar to rB56b0cd1d.

Ref T67671

Reviewers: fclem, brecht

Maniphest Tasks: T67671

Differential Revision: https://developer.blender.org/D5347

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

M	source/blender/editors/interface/interface_draw.c

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

diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 7afdbe9d266..6a36bf364a3 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1606,6 +1606,11 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const
   float sizey_solid = sizey * 0.25f;
   float y1 = rect->ymin;
 
+  /* exit early if too narrow */
+  if (sizex <= 0) {
+    return;
+  }
+
   GPUVertFormat *format = immVertexFormat();
   pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
   immBindBuiltinProgram(GPU_SHADER_2D_CHECKER);



More information about the Bf-blender-cvs mailing list