[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56572] trunk/blender/source/blender/ editors/interface/interface_widgets.c: Fix #35252: Crash with the node placed partially behind the screen

Sergey Sharybin sergey.vfx at gmail.com
Wed May 8 15:16:39 CEST 2013


Revision: 56572
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56572
Author:   nazgul
Date:     2013-05-08 13:16:39 +0000 (Wed, 08 May 2013)
Log Message:
-----------
Fix #35252: Crash with the node placed partially behind the screen

Issue was caused by negative maximal possible text width happening
in label clipping.

Solved by clamping width to 0 if it's negative.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_widgets.c

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2013-05-08 13:01:05 UTC (rev 56571)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2013-05-08 13:16:39 UTC (rev 56572)
@@ -968,7 +968,7 @@
 static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
 	int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
-	int okwidth = BLI_rcti_size_x(rect) - border;
+	int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
 	if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
 
 	/* need to set this first */
@@ -997,7 +997,7 @@
 static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
 	int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
-	int okwidth = BLI_rcti_size_x(rect) - border;
+	int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
 	if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
 
 	BLI_assert(but->editstr && but->pos >= 0);
@@ -1061,7 +1061,7 @@
 static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
 {
 	int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
-	int okwidth = BLI_rcti_size_x(rect) - border;
+	int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
 	char *cpoin = NULL;
 	int drawstr_len = strlen(but->drawstr);
 	char *cpend = but->drawstr + drawstr_len;




More information about the Bf-blender-cvs mailing list