Hi, Thanks for the replies. Sorry I didn't provide enough info in the beginning. Here it is.
On 24-Jan-2013, at 9:55 AM, Graham Cox <[email protected]> wrote: > > On 24/01/2013, at 1:30 PM, Nick Rogers <[email protected]> wrote: > >> Hi, >> >> I was updating a few textfields from my sheetDidEnd:…. method. >> Just wondering if that was causing the crash (UI related error in main >> thread). > > > If written correctly, the sheetDidEnd method is free to access stuff still in > the sheet. In fact, it often has to to ensure any last minute entries in > fields are committed - I usually start my sheetDidEnd methods with [sheet > makeFirstResponder:sheet] to force a focused text field to push its content > to its action method. > > sheetDidEnd methods also often call their delegates, and the delegate must be > able to assume it can access anything (public) in the sheet. > > So whatever your problem is, it's not that. Show your code. The text fields to update are on the main window. On 24-Jan-2013, at 9:03 AM, Andy Lee <[email protected]> wrote: > On Jan 23, 2013, at 9:30 PM, Nick Rogers <[email protected]> wrote: >> I was updating a few textfields from my sheetDidEnd:…. method. >> Just wondering if that was causing the crash (UI related error in main >> thread). > > What happens if you *don't* update the text fields in your sheetDidEnd > method? Does it still crash? The crash doesn't happen always, so no way to tell if not updating the text fields from sheetDidEnd:.. has taken care of it. > > Can you show us the code for the sheetDidEnd method just in case there's a > clue there? > The code is simple. just updating the text fields on the main window, using setStringValue:@"some string". Now I am doing this using performSelectorOnMainThread:. > Are you passing a contextInfo pointer to the sheetDidEnd message? If it's an > object reference, maybe you need to retain it (and then autorelease it in > sheetDidEnd), assuming you're not using ARC. > No context info. its NULL. > Are you using ARC? > The code is not ARC or GC. > Are you remembering to call orderOut: as mentioned in the Sheet Programming > Guide (unlikely to cause a crash, but worth checking)? > I am calling orderOut:self but not from sheetDidEnd:… but from other method which ends the sheet. method is like: [NSApp endSheet:sheetWindow]; [sheetWindow orderOut:self]; Is it okay to do so as between these two statements the sheetDidEnd:… will execute? So, will the execution of second statement happen only after sheet ends. > <https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/sheets/Tasks/UsingCustomSheets.html#//apple_ref/doc/uid/20001290-BABFIBIA> > > Are the text fields in question *on* the sheet? If so, maybe you're trying to > modify them after they've been dealloc'ed due to the sheet being dismissed. > The text fields are on the main window. > Does the stack trace show any of your code, or is it all Apple stuff? > The stack trace shows internal UI problem. selector is retain. Now I am not sure if the sheet is problem, it could be something else too. But knowing the answer will help rule out the sheet part of the code. > Are there any meaningful error messages being logged? > The crash actually show _updateTrackingAreas being called repeatedly and the crash happened just after sheet ends so I just wanted to know the best practices regarding sheet. I am going to post another one with crash report and details of hover button where I am using updateTrackingAreas. The crash happened many seconds after the last hover button was pushed. And after a sheet ended, so started this thread to make sheets clear. > Are you actually crashing or just throwing an exception? What if you add a > breakpoint exception? > Crash happened only once and is not reproducible. Wishes, Nick _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
