TOC | PREV | NEXT

Problem: Program crashes when accessing a color
Solution:
NXColor's were structs, but NSColor's are objects. If you had code which had to work around the fact that you can't pass in structs to methods requiring pointers, such as perform:with:, you are in danger of hitting this bug:

      Old code:
      NXColor *c = [colorWell color];
      [graphic perform:@selector(setColor:) with:&c];

      BAD CODE:
      NSColor *color = [colorWell color];
      [graphic perform:@selector(setColor:) with:&color];
      
      Good code (doesn't dereference color):
      [graphic perform:@selector(setColor:) with:[colorWell color]];
      
      What's so scary is that the dereferencing gives you valid memory space, the NSColor class, since the first variable of an NSColor (and all NSObjects) is the "isa" pointer which goes back to the class. A toughy to find since it crashes on first use, not where you set it...

Problem: In 3.0, you used a Window object for double-buffering your view. You zoom your view, but it doesn't get drawn zoomed.
Solution:
If you are using the NSImage to double-buffer your drawing, you have to remember to explicitly:
            a. scale the width & height by zoom when you resize image.
            b. PSscale(zoom,zoom) after you lockfocus onto image
            

TOC | PREV | NEXT
Match: Format:
Search:
Created by Stone Design's Create on 6/2/1997