• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Breaking on runtime asserts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Breaking on runtime asserts


  • Subject: Re: Breaking on runtime asserts
  • From: Andy Lee <email@hidden>
  • Date: Sat, 27 Jul 2002 22:23:28 -0400

At 3:01 PM -0700 7/27/02, John Scalo wrote:
I am getting random runtime messages like

2002-07-27 14:55:39.651 MyProgram[5006] *** -[NSImage count]: selector not
recognized

This looks like an excellent candidate for a retain bug. You may have neglected to retain an object. The object then got released even though you still had a variable pointing to it, and a new object that you created later reused the first object's memory. So now you had a variable pointing to an NSImage when youre code expected it to be pointing to something else.

However I have no idea where why or when this is happening. Is there an
option (maybe a gdb option?) I can set to break when these runtime asserts
occur?

At 12:14 AM +0200 7/28/02, David Remahl wrote:
Break on [NSException raise]:

(gdb) break -[NSException raise]

Yup, this should help. At the point where the exception is raised, look at the object that is receiving the -count message. You probably declared it to be an NSArray or something similar, but it got written over by an NSImage. That's the object you need to add a -retain call to. See the docs on memory management, in particular retain/release, in your /Developer/Documentation directory. Understanding retain/release is very important.

--Andy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Breaking on runtime asserts
      • From: Finlay Dobbie <email@hidden>
References: 
 >Breaking on runtime asserts (From: John Scalo <email@hidden>)

  • Prev by Date: Re: List Question
  • Next by Date: Putting NSToolbar in an NSView...
  • Previous by thread: Re: Breaking on runtime asserts
  • Next by thread: Re: Breaking on runtime asserts
  • Index(es):
    • Date
    • Thread