[Openmcl-devel] Weird problem with ns-color

Ron Garret ron at flownet.com
Mon Feb 3 21:19:49 PST 2020


On Feb 3, 2020, at 9:14 PM, Ron Garret <ron at flownet.com> wrote:

> I realize that I am way behind the times here, but...
> 
> Welcome to Clozure Common Lisp Version 1.11-r16812M  (DarwinX8664)!
> ? (setf x (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 0.0 0.0 1.0 1.0))
> #<NS-COLOR NSCalibratedRGBColorSpace 0 0 1 1 (#x600000243CF0)>
> ? (setf y (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 0.0 0.0 0.9 1.0))
> #<NS-COLOR NSCalibratedRGBColorSpace 0 0 0.9 1 (#x608000440570)>
> ? x
> #<NS-COLOR NSCalibratedRGBColorSpace 0 0 1 1 (#x600000243CF0)>
> ? y
> #<NS-COLOR NSCalibratedRGBColorSpace 0 0 0.9 1 (#x608000440570)>
> ? 
> 
> Then I close the listener window and open a new listener:
> 
> Welcome to Clozure Common Lisp Version 1.11-r16812M  (DarwinX8664)!
> ? x
> #<NS-COLOR NSCalibratedRGBColorSpace 0 0 1 1 (#x600000243CF0)>
> ? y
> #<Bogus ObjC Object #x608000440570>
> ? 
> 
> This is 100% reproducible,  It is also data-dependent.  Any color with an RGB value that is not numerically equal to 1 or 0 gets corrupted when the listener it was created in is closed.
> 
> My guess is that this has something to do with the first listener’s autorelease pool being drained

Seems I was right:

? (objc:with-autorelease-pool (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 0 0 1.0 1))
#<NS-COLOR NSCalibratedRGBColorSpace 0 0 1 1 (#x600000243CF0)>
? (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 0 0 0.8 1)
#<NS-COLOR NSCalibratedRGBColorSpace 0 0 0.8 1 (#x608000445D90)>
? (objc:with-autorelease-pool (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 0 0 0.8 1))
#<A Foreign Pointer #x600000050350>




More information about the Openmcl-devel mailing list