• 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: Using NSAlert sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSAlert sheets


  • Subject: Re: Using NSAlert sheets
  • From: Michael Watson <email@hidden>
  • Date: Wed, 20 Dec 2006 16:00:05 -0500

Try not autoreleasing the alert object. Release it manually when you're finished with it.


-- m-s

On 19 Dec, 2006, at 21:16, Matt wrote:

Quick question.  I launch a sheet for an action using the code below:

NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle:@"Import Bookmarks"];
[alert addButtonWithTitle:@"Create New Bookmarks"];
[alert setMessageText:@"Your bookmarks are missing!"];
[alert setInformativeText:@"I can't find your bookmarks. If you have a backup, use 'Import Bookmarks' to import your backup copy."];
[alert setAlertStyle:NSCriticalAlertStyle];

// Call the alert sheet asking for migration
[alert beginSheetModalForWindow:mainWindow modalDelegate:self didEndSelector:@selector (BookmarksLoadAlertDidEnd:returnCode:contextInfo:) contextInfo:nil];



The code seems to execute alright, except I get malloc() errors when I run the code, and about 1/10th the time the app is prone to crashing, presumably because of this. I don't see why there should be a problem here, but am I missing something? The errors I get are:


Viewer(2435,0xa000cfc0) malloc: *** Deallocation of a pointer not malloced: 0x18d8c00; 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
Viewer(2435,0xa000cfc0) malloc: *** error for object 0x1875800: incorrect checksum for freed object - object was probably modified after being freed, break at szone_error to debug
Viewer(2435,0xa000cfc0) malloc: *** set a breakpoint in szone_error to debug



I'm going to try and figure out how to set MallocHelp and see what that turns up as well. Just wondering, as right it's causing me some problems.


Thanks

Matt
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40bungie.org


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Using NSAlert sheets
      • From: Ryan Britton <email@hidden>
References: 
 >Using NSAlert sheets (From: Matt <email@hidden>)

  • Prev by Date: NaN passed to _regionForOpaqueDescendants from inside _drawRect:clip:
  • Next by Date: Re: Cocoa-dev Digest, Vol 3, Issue 1474
  • Previous by thread: Re: Using NSAlert sheets
  • Next by thread: Re: Using NSAlert sheets
  • Index(es):
    • Date
    • Thread