Hi all, 

Trying to figure why the following test app crashes when a 'testtest' Apple 
event is sent to it:

------------------------------------------------------------
# cocoatest.py

from PyObjCTools import AppHelper
from Carbon.AE import AEInstallEventHandler

AEInstallEventHandler('test', 'test', lambda evt, res:0)

AppHelper.runEventLoop()

------------------------------------------------------------
# setup.py

from distutils.core import setup
import py2app

setup(app=['cocoatest.py'], data_files=['MainMenu.nib']) # default IB 
application nib

------------------------------------------------------------
-- test.applescript

tell application "cocoatest" to «event testtest»

------------------------------------------------------------


The test app builds and runs fine, but running the test.applescript causes it 
to fall over with the following traceback:

------------------------------------------------------------

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000008

Thread 0 Crashed:
0   org.python.python                   0x10023684 PyFrame_New + 32 
(frameobject.c:540)
1   org.python.python                   0x1007aab0 PyEval_EvalCodeEx + 148 
(ceval.c:2523)
2   org.python.python                   0x10026274 function_call + 344 
(funcobject.c:548)
3   org.python.python                   0x1000c348 PyObject_Call + 48 
(abstract.c:1752)
4   org.python.python                   0x1007c26c 
PyEval_CallObjectWithKeywords + 256 (ceval.c:3420)
5   _AE.so                              0x0024b9d8 _AEDesc_NewBorrowed + 476
6   com.apple.AE                        0x914ab960 aeDispatchAppleEvent(AEDesc 
const*, AEDesc*, unsigned long, unsigned char*) + 208
7   com.apple.AE                        0x914ab7fc 
dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 44
8   com.apple.AE                        0x914ab654 aeProcessAppleEvent + 284
9   com.apple.HIToolbox                 0x93188940 AEProcessAppleEvent + 60
10  com.apple.AppKit                    0x93683adc _DPSNextEvent + 856
11  com.apple.AppKit                    0x936835c8 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 116
12  com.apple.AppKit                    0x9367fb0c -[NSApplication run] + 472
13  com.apple.AppKit                    0x93770618 NSApplicationMain + 452
14  _AppKit.so                          0x0040810c init_AppKit + 6484
15  org.python.python                   0x1007c5ec call_function + 828 
(ceval.c:3547)
16  org.python.python                   0x1007a140 PyEval_EvalFrame + 8888 
(ceval.c:2163)
17  org.python.python                   0x1007b284 PyEval_EvalCodeEx + 2152 
(ceval.c:2730)
18  org.python.python                   0x1007c8cc fast_function + 356 
(ceval.c:3644)
19  org.python.python                   0x1007c6c4 call_function + 1044 
(ceval.c:3568)
20  org.python.python                   0x1007a140 PyEval_EvalFrame + 8888 
(ceval.c:2163)
21  org.python.python                   0x1007b284 PyEval_EvalCodeEx + 2152 
(ceval.c:2730)
22  org.python.python                   0x1007e678 PyEval_EvalCode + 48 
(ceval.c:484)
23  org.python.python                   0x100b2ee0 run_node + 76 
(pythonrun.c:1265)
24  org.python.python                   0x10070af4 builtin_execfile + 520 
(bltinmodule.c:623)
25  org.python.python                   0x1007c5ec call_function + 828 
(ceval.c:3547)
26  org.python.python                   0x1007a140 PyEval_EvalFrame + 8888 
(ceval.c:2163)
27  org.python.python                   0x1007b284 PyEval_EvalCodeEx + 2152 
(ceval.c:2730)
28  org.python.python                   0x1007c8cc fast_function + 356 
(ceval.c:3644)
29  org.python.python                   0x1007c6c4 call_function + 1044 
(ceval.c:3568)
30  org.python.python                   0x1007a140 PyEval_EvalFrame + 8888 
(ceval.c:2163)
31  org.python.python                   0x1007b284 PyEval_EvalCodeEx + 2152 
(ceval.c:2730)
32  org.python.python                   0x1007e678 PyEval_EvalCode + 48 
(ceval.c:484)
33  org.python.python                   0x100b2ee0 run_node + 76 
(pythonrun.c:1265)
34  org.python.python                   0x100b266c PyRun_SimpleFileExFlags + 
592 (pythonrun.c:863)
35  ...onmac.unspecified.cocoatest      0x00003db0 0x1000 + 11696
36  ...onmac.unspecified.cocoatest      0x00003e50 0x1000 + 11856
37  ...onmac.unspecified.cocoatest      0x00002414 0x1000 + 5140
38  dyld                                0x8fe01048 _dyld_start + 60

------------------------------------------------------------

Additional notes: the test app doesn't crash when AppKit.NSAppleEventManager is 
used to install the event handler function, nor when CarbonEvt is used instead 
of PyObjC. 

I'm getting a similar crash in some CarbonX.OSA code within a PyObjC-based app 
and reckon identifying what's causing the test app to crash will help me solve 
the problem there. Any ideas as to the cause, suggestions where to look, how to 
debug it more effectively, etc. would be a big help as I've been stuck on this 
for more than a day now and have only just fitted a new laptop case after the 
last temper tantrum. :p

Many thanks,

has
-- 
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to