• 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: Subclassing NSToolbar is *almost* really good
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSToolbar is *almost* really good


  • Subject: Re: Subclassing NSToolbar is *almost* really good
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Mon, 3 May 2004 14:16:32 -0700

Hello...

The problem seems to be that you have implemented the delegate methods within your subclass of NSToolbar.

NSToolbar has existing implementations of the

- (id)toolbarDefaultItemIdentifiers:(id)fp8;
- (id)toolbarAllowedItemIdentifiers:(id)fp8;

methods (and possibly others), which may or may not be supposed to return the same types as the delegate methods. Your implementations of the delegate methods override these methods, and seem to be conficting with the original NSToolbar methods and causing the "explosion".

These methods are undeclared in NSToolbar (ie private), and you should probably file a bug regarding the fact that the NSToolbar methods should probably use the standard Apple underscore prefix to avoid collisions. There are probably other people who will/have done the same thing you are doing, even though as a general rule, delegate methods aren't intended to be implemented in the class that uses them.


So, the moral of the story is:

Delegate methods should be implemented in delegates :)


Hope that helps,

Louis

It would be fully good if it didn't explode whenever I try to run the
customization palette either programatically or by right-clicking on
the toolbar and selecting Customize Toolbar. By "explode" I mean
spewing out half a dozen of the following:

2004-05-04 00:29:40.844 BBToolbarTest[2174] ***
-[NSAttributeDictionary selectedItemIdentifier]: selector not
recognized

No customization palette is produced. Then, when I click some
no-longer-functional toolbar items and then quit the app I get the
following message:

*** malloc[2174]: Deallocation of a pointer not malloced: 0xbfffe420;
This could be a double free(), or free() called with the middle of an
allocated block; Try setting environment variable MallocHelp to see
tools to help debug

I've been going crazy trying to figure out where the first message is
coming from. I've created a little demo Xcode project demonstrating the
subclass in all its glory hoping that someone may care to check it out
and spot a something that I missed.
http://betterbomb.com/BBToolbarTest.zip

Cheers!
john
_______________________________________________
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: Subclassing NSToolbar is *fully* really good
      • From: John Lombardo <email@hidden>
References: 
 >Subclassing NSToolbar is *almost* really good (From: John Lombardo <email@hidden>)

  • Prev by Date: Re: Subclassing NSToolbar is *almost* really good
  • Next by Date: NSOpenPanel Oddity
  • Previous by thread: Re: Subclassing NSToolbar is *almost* really good
  • Next by thread: Re: Subclassing NSToolbar is *fully* really good
  • Index(es):
    • Date
    • Thread