discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Bug in gui 0.9.2 (NSImage::size)


From: David Ayers
Subject: Re: Bug in gui 0.9.2 (NSImage::size)
Date: Sat, 29 May 2004 19:46:16 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514

Andreas Höschler wrote:
Hi all,

I found a bug in the latest gui. I get an "Illegal Instruction (core dumped)" in NSImage.m

- (NSSize) size
{
  if (_size.width == 0)
    {
        NSLog(@"size A");
      NSImageRep *rep = [self bestRepresentationForDevice: nil];
        NSLog(@"size B %@", rep);
      _size = [rep size];    // <-- core dumped is raised here
        NSLog(@"size C");
    }
  return _size;
}

-bestRepresentationForDevice returns nil in my case. Then [rep size] is called which is not a good idea. Bummh!!! I haven't looked too much into NSImage yet and whether one should expect bestRepresentationForDevice to return nil. If anybody immediately knows what's wrong here I would be glad for a pointer.


NSSize is a structure but the method to nil returns nil.

the fix would be:

...
if (rep != nil)
  {
    _size = [rep size];
  }
...

But I currently have other issues so I can't commit the fix right now. Unless someone beats me to it I'll try to do it later today.

Cheers,
David




reply via email to

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