Revision: 26572
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26572
Author:   campbellbarton
Date:     2010-02-03 10:39:46 +0100 (Wed, 03 Feb 2010)

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

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

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c  2010-02-03 
09:05:31 UTC (rev 26571)
+++ trunk/blender/source/blender/editors/interface/interface.c  2010-02-03 
09:39:46 UTC (rev 26572)
@@ -372,12 +372,16 @@
        /* 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)


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to