discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interesting error in GWorkspace


From: Eric Wasylishen
Subject: Re: Interesting error in GWorkspace
Date: Fri, 9 Sep 2011 13:53:03 -0600

Hi Riccardo,
I think I found the problem. Sorry about this, it was a sloppy mistake on my 
part.

When I modified _doImageCache:, I was assuming the rep parameter would be 
non-nil, so I sent [rep size] to it and used that when setting up the cache. 
But in fact, the rep parameter is nil when you lock focus on an image with no 
representations (which the Dock.m code was doing.) I guess we should add a test 
case for that in the gui test suite, since it would have caught this mistake.

Regards
Eric

On 2011-09-09, at 5:13 AM, Riccardo Mottola wrote:

> Hi,
> 
> some updates
> 
> On 09/08/11 21:04, Eric Wasylishen wrote:
>> I added two extra checks: one against creating a NSCachedImageRep with a 
>> size of zero (it looks like that is where the NSView with size 0,0 was 
>> coming from), and a check against locking focus on an image with a size of 
>> 0,0.
>> 
>> Maybe those will help isolate the problem a bit..
>> 
>> Actually, I just looked at Dock.m:
>> 
>> - (void)setBackImage
>> {
>>   NSImage *image = [[manager desktopView] backImage];
>>   int i;
>> 
>>   DESTROY (backImage);
>> 
>>   if (image) {
>>     NSRect r = [self bounds];
>> 
>>     backImage = [[NSImage alloc] initWithSize: r.size];
>>     [backImage lockFocus];
>>     [image compositeToPoint: NSZeroPoint
>>                    fromRect: r
>>                   operation: NSCompositeCopy];
>> 
>> I bet "r" has a size of (0, 0).. I wonder why the bounds would be zero?
> 
> The exceptions in the console are now more terse after your fix.
> 
> 2011-09-09 10:07:12.568 GWorkspace[2677] Problem posting notification: 
> <NSException: 0xb9eab664> NAME:NSInvalidArgumentException 
> REASON:NSCachedImageRep created with size {width = -1.49882; height = 
> 1.28695e-41} pixelsWide -1 pixelsHigh 0 INFO:(null)
> 
> a negative width and a near-zero height :)
> 
> Except wondering why "problem posting" the contents is bad.
> 
> Now I can see the dock, I attach a screen shot. It seems that the dock has a 
> reasonable width/height as expected (Everything worked here before my 
> departure in August...) and some icons are drawn on top of each other. I 
> smell something dishy but difficult to understand what.
> 
> I put a breakpoint in Dock.m. Interestingly, I never break into line 419, but 
> I put it in 412.
> 
> At the first occurrence,
> (gdb) p r
> $3 = {origin = {x = 0, y = 0}, size = {width = 64, height = 192}}
> 
> It is also the only run I get in that breakpoint. Thus it is not caused by r 
> = 0.
> backImage gets alloc'd... and then te lock gets called.
> 
> I tried stepping through:
> 
> (gdb) finish
> Run till exit from #0  0xbb8ac305 in -[NSImage lockFocusOnRepresentation:] (
>    self=0xb901a674, _cmd=0xbba8bc98, imageRep=0x0) at NSImage.m:1063
> 
> 2011-09-09 13:11:03.790 GWorkspace[1942] Problem posting notification: 
> <NSException: 0xb901d9a4> NAME:NSInvalidArgumentException 
> REASON:NSCachedImageRep created with size {width = -0.00359415; height = 
> 1.28695e-41} pixelsWide 0 pixelsHigh 0 INFO:(null)
> 2011-09-09 13:11:05.728 GWorkspace[1942] Unable to obtain lock (null)
> 
> So it appears that the image is alloc'd but at least one representation is 
> invalid (imageRep=0x0) and we are calling a lock on it.
> 
> Riccardo
> <broken_dock.gif>_______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep




reply via email to

[Prev in Thread] Current Thread [Next in Thread]