title: NSMutableDIctionary setObject: ForKey crashing when Key is member of Object
body: <p>I'm trying to use an NSMutableDictionary to pair my custom classes object with a UIButton as it's key.  The UIButton that is the key is also a member of the object that I want to store as the object in the NSMutableDictionary.</p>
  
  <p>My Class definition looks like ths:</p>
  
  <pre><code>@interface ClassA : NSObject {
  @public
      UIButton *button1;
      UIButton *button2;
      UILabel *label;
  }
  
  @property (nonatomic, retain) UIButton *button1;
  @property (nonatomic, retain) UIButton *button2;
  @property (nonatomic, retain) UILabel *label;
  @end
  </code></pre>
  
  <p>And my implementation is just this:</p>
  
  <pre><code>@implementation ClassA
  @synthesize button1, button2, label;
  @end
  </code></pre>
  
  <p>The NSMutableDictionary is in another class.  I define it in the implementation like this:</p>
  
  <pre><code>@interface UIClass1 : UIViewController {
      NSMutableDictionary *Dictionary;
  }
  
  -(void)DoWork;
  
  @property (nonatomic, retain) NSMutableDictionary *Dictionary;
  @end
  </code></pre>
  
  <p>And the part where I'm trying to set the Dictionary values is done here:</p>
  
  <pre><code>-(void)DoWork{
      Dictionary = [[NSMutableDictionary alloc] init];
      ObjectA = [[ClassA alloc] init];
  
      ObjectA-&gt;button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
      ObjectA-&gt;button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
      ObjectA-&gt;label = [[[UILabel alloc] initWithFrame:CGRectMake(20, 20, 20, 20)] autorelease]
  
      /* THIS IS A TEST AND IT WORKS FINE */
      NSString *str = [[NSString alloc] initWithFormat:@"test"];
      [Dictionary setObject:obj1 forKey:str];
  
      /*THIS IS WHAT I WOULD ACTUALLY LIKE TO DO */
      [Dictionary setObject:Object1 forKey:ObjectA-&gt;button1];
      [Dictionary setObject:ObjectA forKey:ObjectA-&gt;button2];
  }
  </code></pre>
  
  <p>I've followed this code through my debugger and when I get to this line:  </p>
  
  <pre><code>[Dictionary setObject:Object1 forKey:ObjectA-&gt;button1];
  </code></pre>
  
  <p>It just crashes SIGABRT.  None of my variables are nil, every object has been allocated. </p>
  
  <p>Any ideas as to why I can't set the key to the button from ClassA but I can set it the the NSString I created as a test?</p>