Re: App Crashing in ARC !!

2012-02-24 Thread KappA
Based on this line:

 -[NSPanel release]: message sent to deallocated instance 0x111c74a60*

And this from the stack trace:

*#2  0x7fff8ff49ca0 in CFRelease ()*

Looks like you're over releasing. Perhaps ensure that the object is
declared as strong so that you keep a reference of it around?

This is just my guess based on the above. You should enable NSZombie and
malloc stack and see if you get any more info. If not, at least you have an
idea that it's the NSPanel, and you can take a closer look at that in your
code.

I happened to see this on the documentation for NSAlert which looks
interesting...

*begin quote*
Linkhttps://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSAlert_Class/Reference/Reference.htmlSpecial
Considerations

This is a compatibility method. It is designed for easy adoption by
applications migrating from the corresponding function-based API. This
method uses earlier return
values—NSAlertDefaultReturnhttps://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPanel_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSAlertDefaultReturn
,NSAlertAlternateReturnhttps://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPanel_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSAlertAlternateReturn,
and 
NSAlertOtherReturnhttps://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPanel_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSAlertOtherReturn—compatible
with the earlier API, rather than the return values defined by the
NSAlert class,
described in “Button Return
Values.”https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAlert_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Button_Return_Values

Unless you must maintain compatibility with existing alert-processing code
that uses the function-based API, you should allocate (alloc) and
initialize (init) the object, and then set its attributes using the
appropriate methods of the NSAlert class.
*end quote*

Anyways, good luck and maybe someone else might chime in with a more
conclusive answer.

Thanks,
Kappa


On Thu, Feb 23, 2012 at 3:01 PM, Fritz Anderson fri...@manoverboard.orgwrote:

 On 22 Feb 2012, at 9:31 PM, Naresh Kongara wrote:

  I'm creating the alert with class method in NSAlert and running it with
 runModal.
 
  NSAlert *alert =[NSAlert
 alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:];
  if ([alert runModal] == NSAlertDefaultReturn) {
  //Code
  }
  This crash is happening only after we migrated to ARC. I tried with
 analyzer and Zombies, but no success in finding the cause for the crash.

 You've provided a skeleton of how you intend to do something, but nothing
 that shows what you are actually doing. You've provided nothing more than
 make an alert and run it. If there is a bug in this section of your code,
 it's probably in the construction of the parameters to alertWith…, or in
 Code.

 If your actual code is terribly complex, or proprietary, reduce it to a
 minimal case that reproduces it, and post it. Creating a minimal case will
 often show you your problem with no need to consult anyone else.

 Also: By any chance, are you running this alert on any thread other than
 the main one? You can't do that. You'll crash.

— F


 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 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:
 https://lists.apple.com/mailman/options/cocoa-dev/rejekted%40gmail.com

 This email sent to rejek...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: App Crashing in ARC !!

2012-02-23 Thread Fritz Anderson
On 22 Feb 2012, at 9:31 PM, Naresh Kongara wrote:

 I'm creating the alert with class method in NSAlert and running it with 
 runModal.
 
 NSAlert *alert =[NSAlert 
 alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:];
 if ([alert runModal] == NSAlertDefaultReturn) {
 //Code
 }
 This crash is happening only after we migrated to ARC. I tried with analyzer 
 and Zombies, but no success in finding the cause for the crash.

You've provided a skeleton of how you intend to do something, but nothing that 
shows what you are actually doing. You've provided nothing more than make an 
alert and run it. If there is a bug in this section of your code, it's 
probably in the construction of the parameters to alertWith…, or in Code.

If your actual code is terribly complex, or proprietary, reduce it to a minimal 
case that reproduces it, and post it. Creating a minimal case will often show 
you your problem with no need to consult anyone else.

Also: By any chance, are you running this alert on any thread other than the 
main one? You can't do that. You'll crash.

— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com