[Drawkit] Important Bug Fix
Brad Larson
larson at sonoplot.com
Fri Jun 6 18:01:27 PDT 2008
Sure enough, that does the trick with the crashy sheets. I figured it
was something bizarre when I did a quick look-through to see what was
causing that behavior.
Earlier this year, I spent a little under a month tracking a random
crashing bug all the way to an sprintf call that looked correct, but
was corrupting memory on Leopard (lesson: avoid sprintf if you can).
On Jun 5, 2008, at 7:37 PM, Graham Cox wrote:
> I'm putting this on the list ahead of a downloadable update because
> it's fairly important.
>
> In DKGradient.m, change the following function:
>
> static int cmpColorStops (DKColorStop* lh, DKColorStop* rh, void
> *context)
> {
> #pragma unused(context)
>
> float lp = [lh position];
> float rp = [rh position];
>
> if (lp < rp)
> return NSOrderedAscending;
> else if (lp > rp)
> return NSOrderedDescending;
> else
> return NSOrderedSame;
> }
>
>
> Previously the lh and rh parameters were passed as type id, now
> they're explicit. (Also update the prototype or remove it).
>
> This change allows you to compile against the 10.5 SDK without any
> runtime problems. This might seem counter-intuitive and it is - took
> me 11 hours to track this one down - but the call to the -position
> method was corrupting memory when using the 10.5 SDK because new
> Leopard classes implement -position, returning larger data types
> than a float, which was overwriting memory leading to bizarre
> runtime bugs like sheets failing to work. The strong typing of lh
> and rh make sure the code is compiled correctly.
>
> cheers, Graham
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562
More information about the Drawkit
mailing list