bugfix [#20944] bad use of wm.invoke_popup(self) is crashing Blender

This commit is contained in:
Campbell Barton
2010-02-03 09:39:46 +00:00
parent 53596fc6b8
commit 3289eff6d9
+5 -1
View File
@@ -372,12 +372,16 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
/* and we adjust the position to fit within window */
width= block->maxx - block->minx;
height= block->maxy - block->miny;
/* avoid divide by zero below, caused by calling with no UI, but better not crash */
oldwidth= oldwidth > 0 ? oldwidth : MAX2(1, width);
oldheight= oldheight > 0 ? oldheight : MAX2(1, height);
/* offset block based on mouse position, user offset is scaled
along in case we resized the block in ui_text_bounds_block */
startx= window->eventstate->x + block->minx + (block->mx*width)/oldwidth;
starty= window->eventstate->y + block->miny + (block->my*height)/oldheight;
if(startx<10)
startx= 10;
if(starty<10)