• 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: Problem on clearing points and paths on a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem on clearing points and paths on a NSView


  • Subject: Re: Problem on clearing points and paths on a NSView
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 22 Jul 2008 21:06:23 -0700


On 22 Jul '08, at 6:45 PM, JArod Wen wrote:

Now I am considering the possible memory leakage in renderPath, since each time the path will be initialized and the previous one will cause memory leakage, which may be also the reason why I cannot get rid of them from the view. But if so, how about the renderPoint? It seems ok but still cannot be removed...

-renderPath does have memory leaks (unless you've turned on garbage collection) because it allocs pathPoint but never releases it. You just need to add a single [pathPoint release] at the end of that block. (Or just use [NSBezierPath bezierPathWithOvalInRect:], which is an easier way to create a circle and doesn't require you to release the result.)


As Graham pointed out, the reason your shapes don't get erased is that you don't erase them. Your -drawRect method needs to begin by clearing the passed-in NSRect to the background color, otherwise you may be leaving behind the old contents of the view.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Problem on clearing points and paths on a NSView
      • From: "Ken Ferry" <email@hidden>
References: 
 >Problem on clearing points and paths on a NSView (From: JArod Wen <email@hidden>)
 >Re: Problem on clearing points and paths on a NSView (From: Jens Alfke <email@hidden>)
 >Re: Problem on clearing points and paths on a NSView (From: JArod Wen <email@hidden>)

  • Prev by Date: Re: CA: Are nested 3D transforms supported?
  • Next by Date: Re: Problem on clearing points and paths on a NSView
  • Previous by thread: Re: Problem on clearing points and paths on a NSView
  • Next by thread: Re: Problem on clearing points and paths on a NSView
  • Index(es):
    • Date
    • Thread