Error executing instruction "[NSBezierPath bezierPath]"

  • Hi,

    In my application, I am constructing the NSBezierPath based on the
    mouse click points on the NSImageView.
    I am using the method "[NSBezierPath bezierPath]", for creating the
    NSBezierPath.

    But, while running application, I am getting the console message saying,
    "+[NSBezierPath bezierPath] unrecognized selector sent to class
    0xa0315180".
    and
    "-[NSBezierPath _deviceMoveToPoint] unrecognized selector sent to
    class 0xa0315180".

    Any help would be greatly appreciated in understanding these messages.

    Any specific reasons, why application throwing console logs for
    "[NSBezierPath bezierPath]".
    Which is the designated initializer for NSBezierPath object.

    -Vinay
  • Vinay Prabhu <mailto:<vinay.prabhu...> wrote
    (Monday, January 7, 2008 11:11 PM +0530):

    > In my application, I am constructing the NSBezierPath based on the
    > mouse click points on the NSImageView. I am using the method
    > "[NSBezierPath bezierPath]", for creating the NSBezierPath.
    >
    > But, while running application, I am getting the console message
    > saying, "+[NSBezierPath bezierPath] unrecognized selector sent to
    > class 0xa0315180". and "-[NSBezierPath _deviceMoveToPoint]
    > unrecognized selector sent to class 0xa0315180".
    >
    > Any help would be greatly appreciated in understanding these messages.
    >
    > Any specific reasons, why application throwing console logs for
    > "[NSBezierPath bezierPath]". Which is the designated initializer for
    > NSBezierPath object.

    You probably have an over-release issue. My guess is that you're
    not retaining the NSBezierPath returned by the convenience
    constructor and it's getting released. Eventually that memory
    location gets replaced with another object and the stale pointer
    to the (now replaced) NSBezierPath objects sends the new object
    a message. The new object doesn't accept that message and this
    is the result.

    First, I'd review your code to make sure that NSBizerPath is
    being retained for the lifetime of the reference to it. An open
    manhole that I'm always walking into is in subclasses of NSCell.
    NSCells get copied (a lot!). If you subclass it -- and the
    subclass has object references -- you *must* implement the
    necessary copy methods or the copies will contain under-retained
    object references.

    If you can't find your problem with a casual review, check out
    NSZombies (famous tech note #2124
    <http://developer.apple.com/technotes/tn2004/tn2124.html>). That
    will at least confirm the problem. To see where it's actually
    getting retained and released, run your application using
    ObjectAlloc (Tiger) or using the ObjectAlloc instrument in
    Instruments (Leopard).

    See
    <http://developer.apple.com/documentation/Performance/Conceptual/ManagingMem
    ory/ManagingMemory.html
    >
    for a general discussion, tips for finding problems, and on
    using ObjectAlloc.

    --
    James Bucanek
  • James Bucanek <mailto:<subscriber...> wrote (Monday,
    January 7, 2008 8:47 AM -0700):

    > You probably have an over-release issue.

    P.S. If you're targeting Leopard exclusively, you might consider
    switching over to using automatic garbage collection and
    avoiding these issues entirely.

    --
    James Bucanek
  • Thanks for the response.
    I set up the NSZombie enviornment variable.
    But the crash appears when I run the application in Deployment mode.
    When I run the application in Debug mode, crash will not appear !!!!!

    I have added retain to all instances of [NSBezierPath bezierPath]
    initializer.

    -Vinay

    On Jan 7, 2008, at 9:17 PM, James Bucanek wrote:

    > Vinay Prabhu <mailto:<vinay.prabhu...> wrote (Monday,
    > January 7, 2008 11:11 PM +0530):
    >
    >> In my application, I am constructing the NSBezierPath based on the
    >> mouse click points on the NSImageView. I am using the method
    >> "[NSBezierPath bezierPath]", for creating the NSBezierPath.
    >>
    >> But, while running application, I am getting the console message
    >> saying, "+[NSBezierPath bezierPath] unrecognized selector sent to
    >> class 0xa0315180". and "-[NSBezierPath _deviceMoveToPoint]
    >> unrecognized selector sent to class 0xa0315180".
    >>
    >> Any help would be greatly appreciated in understanding these
    >> messages.
    >>
    >> Any specific reasons, why application throwing console logs for
    >> "[NSBezierPath bezierPath]". Which is the designated initializer for
    >> NSBezierPath object.
    >
    > You probably have an over-release issue. My guess is that you're not
    > retaining the NSBezierPath returned by the convenience constructor
    > and it's getting released. Eventually that memory location gets
    > replaced with another object and the stale pointer to the (now
    > replaced) NSBezierPath objects sends the new object a message. The
    > new object doesn't accept that message and this is the result.
    >
    > First, I'd review your code to make sure that NSBizerPath is being
    > retained for the lifetime of the reference to it. An open manhole
    > that I'm always walking into is in subclasses of NSCell. NSCells get
    > copied (a lot!). If you subclass it -- and the subclass has object
    > references -- you *must* implement the necessary copy methods or the
    > copies will contain under-retained object references.
    >
    > If you can't find your problem with a casual review, check out
    > NSZombies (famous tech note #2124 <http://developer.apple.com/technotes/tn2004/tn2124.html
    > >). That will at least confirm the problem. To see where it's
    > actually getting retained and released, run your application using
    > ObjectAlloc (Tiger) or using the ObjectAlloc instrument in
    > Instruments (Leopard).
    >
    > See <http://developer.apple.com/documentation/Performance/Conceptual/ManagingMem
    ory/ManagingMemory.html
    > > for a general discussion, tips for finding problems, and on using
    > ObjectAlloc.
    >
    >
    > --
    > James Bucanek
    >
    >
  • Vinay Prabhu <mailto:<vinay.prabhu...> wrote
    (Tuesday, January 8, 2008 12:14 AM +0530):

    > Thanks for the response.
    > I set up the NSZombie enviornment variable.
    > But the crash appears when I run the application in Deployment mode.

    (Note: It's not crashing; it's throwing an exception.)

    > When I run the application in Debug mode, crash will not appear !!!!!
    >
    > I have added retain to all instances of [NSBezierPath bezierPath] initializer.

    Then you probably need to enable NSZombies and/or run the
    application under the debugger and set a break at the exception
    handler for unrecognized message (I can't remember what is is,
    but I think it's mentioned in the error message logged by the exception).

    That should tell you if you have a release issue, or what the
    object is that you're trying to send the message to.

    --
    James Bucanek
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today