applicationShouldOpenUntitledFile: activity causes AE-related crash?!?
applicationShouldOpenUntitledFile: activity causes AE-related crash?!?
- Subject: applicationShouldOpenUntitledFile: activity causes AE-related crash?!?
- From: Allan Odgaard <email@hidden>
- Date: Fri, 24 Sep 2004 05:02:49 +0200
I want to save which windows were open at exit, and re-open these when
launching my application, unless the application was opened with a file
argument.
What I do is save this info (to user defaults) in the
applicationShouldTerminate: application delegate method.
Then in applicationShouldOpenUntitledFile: I check for saved info, if
there is any, I return NO and open the windows (using
performSelector:withObject:afterDelay:). And in the central "open
file" method which the various application delegate methods to open
documents go through, I remove any potential info from the user
defaults.
My problem is that one beta tester reports, that now my application
crashes when he had open windows at exit (unless he opens my
application with a file argument), and this is the (slightly edited)
stack dump he has given me:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x00a6d008
Thread 0 Crashed:
0 com.apple.Foundation NSPopAutoreleasePool
1 com.apple.Foundation _NSAppleEventManagerGenericHandler
2 com.apple.AE aeDispatchAppleEvent(...)
3 com.apple.AE dispatchEventAndSendReply(...)
4 com.apple.AE aeProcessAppleEvent
5 com.apple.HIToolbox AEProcessAppleEvent
6 <<00000000>> [address]
...
10 com.macromates.textmate _start + 0x188 (crt.c:267)
11 dyld _dyld_start + 0x64
The blank lines all had <<00000000>>.
I am really clueless to what happens, since there is really only one
line mentioning my application (#10). And he is the only one who has
the problem (and it's not like I don't know what I'm doing or not
mastering retain counts etc. when I code ;) ).
I can see from the dump that my application is patched
by:ApplicationEnhancer, Menu Master, WindowShade X, CocoaGestures, and
TextExtras -- but I have tried to install all these things myself, w/o
reproducing a crash on my side.
So I thought I would try to write this list to learn, if anyone has
experienced something similar? I do recall reading that APE makes
applications unstable, but I also read a rebuttal by Unsanity, and I
think that it would probably then also happen on my system and/or to
other programs that my beta tester runs -- and I don't see why this new
feature should trigger it (it's 100% reproducible with the feature
enabled on his system, and never happens for him with it disabled).
So more likely I am screwing up NSApplications AE handling, which is
also sort of what is implied by the stack dump -- but how and why? and
why not deterministic?
I guess for the next version I will make it so that a boolean is set in
applicationShouldOpenUntitledFile: and tested in
applicationDidFinishLaunching:, rather than using
performSelector:withObject:afterDelay:.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden