[BUG] VM crash with #magnify:by:smoothing: 0

John M McIntosh johnmci at smalltalkconsulting.com
Mon Nov 25 21:27:22 UTC 2002


Ah  ignore the comment found in the code, this method gets called with  
smoothing: set to 0 because the caller, warpLoop only cares if
smoothing is not 1.  As you can see n (smoothing) gets 0, which then  
does things like "xdh _ xDeltah // n" can you say "divide by zero"?

Now that doesn't crash on os-x 3.4.0b2 (should it?), but a bit later in  
the logic we attempt to use n as a positive non-zero start point to  
decrement a while loop test. That of course *never completes" and  
Squeak hangs in the primitive spinning forever.

Sounds like you need to propose a changeset to ensure we don't pass in  
a smoothing value < 1.


warpPickSmoothPixels: nPixels
	xDeltah: xDeltah yDeltah: yDeltah
	xDeltav: xDeltav yDeltav: yDeltav
	sourceMap: sourceMap
	smoothing: n
	dstShiftInc: dstShiftInc
	"Pick n (sub-) pixels from the source form, mapped by sourceMap,
	average the RGB values, map by colorMap and return the new word.
	This version is only called from WarpBlt with smoothingCount > 1"
	| rgb x y a r g b xx yy xdh ydh xdv ydv dstMask destWord i j k nPix |
	self inline: false. "nope - too much stuff in here"
	dstMask _ maskTable at: destDepth.
	destWord _ 0.
	n = 2 "Try avoiding divides for most common n (divide by 2 is  
generated as shift)"
		ifTrue:[xdh _ xDeltah // 2. ydh _ yDeltah // 2.
				xdv _ xDeltav // 2. ydv _ yDeltav // 2]
		ifFalse:[xdh _ xDeltah // n. ydh _ yDeltah // n.
				xdv _ xDeltav // n. ydv _ yDeltav // n].
.... (more stuff)

On Monday, November 25, 2002, at 11:40  AM, Ned Konz wrote:

> | f scaleX scaleY |
> 	f _ aMorph imageForm.
> 	aMorph fullReleaseCachedState.
> 	scaleY _ 14 / f height.  "keep height invariant"
> 	scaleX _ ((aMorph width * scaleY) <= 14)
> 		ifTrue:
> 			[scaleY]  "the usual case; same scale factor, to preserve aspect
> ratio"
> 		ifFalse:
> 			[self width / f width].
> 	^(f magnify: f boundingBox by: (scaleX @ scaleY) smoothing: 0).
>
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list