Hi folks.  I've done a load of googling after getting SIG(variable) errors
when adding and removing objects to/from an arrayController in pyobjc and can't seem
to figure this one out. I've tried the pyobjc list and have no response so far.
Apologies for cross-posting and please let me know if I'm asking the question poorly, vaguely,
or on the wrong mailing list.

I set Signals.dumpStackOnFatalSignal() as well as
Debugging.installVerboseExceptionHandler () and then I start adding python
(subclassing NSObject) objects to my NSArrayController. After a variable
number of additions and/or subtractions, I get the stack trace below. (there
are no other errors, including those related to KVC compliance, etc)

Intuition is telling me that I may be in trouble because I'm instantiating
python singleton objects (subclassing the class directly below) as
attributes of the object that I'm adding to the NSArrayController, but I
could be way off here.

*Update: I removed all singletons from my code and have the same behavior.
*Update: this happens whether or not I have the objects delete on removal from the
controller.

class scAbstractSingleton(object):
def __new__(cls, *args, **kwds):
it = cls.__dict__.get("__it__")
if it is not None: return it
cls.__it__ = it = object.__new__(cls)
it.init(*args, **kwds)
return it

def init(self, *args, **kwds):
pass

Is there a way post-mortem to get the object that *was* at 0x114d740 in the
trace below? Is there a way to recursively enumerate all attributes of a
given object to do a print(theAttribute) on instantiation? That could be
crazy... Any cool pdb tricks I should know?

I assume that figuring out which object (0x114d740 in the trace below) was
freed is a good place to start, but I don't know if that's possible in
retrospect, as that object is freed. I can see the memory referenced in
gdb, but I don't see anything that would help...at least not to my
inexperienced eyes. Who knows the proper voodoo?

Thanks in advance to the cocoa/pythonistas!

Cheers,
Jonathan Saggau

2006-03-27 21:10: 28.897 Trigger[436] *** ObjC exception
'NSUncaughtRuntimeErrorException' (reason: 'objc: FREED(id): message retain
sent to freed object=0x114d740') discarded
Stack trace (most recent call last):
__dyld_start (in dyld)
0x00002414 (in Trigger)
0x00003e50 (in Trigger)
0x00003db0 (in Trigger)
_PyRun_SimpleFileExFlags (in Python)
_PyRun_FileExFlags (in Python)
_PyEval_EvalCode (in Python)
_PyEval_EvalCodeEx (in Python)
_PyEval_EvalCode (in Python)
_PyEval_GetFuncDesc (in Python)
_PyEval_GetFuncDesc (in Python)
_PyEval_EvalCodeEx (in Python)
_PyEval_EvalCode (in Python)
_PyEval_GetFuncDesc (in Python)
__PyUnicodeUCS2_IsAlpha (in Python)
_PyRun_FileExFlags (in Python)
_PyEval_EvalCode (in Python)
_PyEval_EvalCodeEx (in Python)
_PyEval_EvalCode (in Python)
_PyEval_GetFuncDesc (in Python)
_PyEval_GetFuncDesc (in Python)
_PyEval_EvalCodeEx (in Python)
_PyEval_EvalCode (in Python)
_PyEval_GetFuncDesc (in Python)
_objc_NSApplicationMain (in _AppKit.so) (_AppKit.m:129)
_NSApplicationMain (in AppKit)
-[NSApplication run] (in AppKit)
-[NSApplication sendEvent:] (in AppKit)
-[NSWindow sendEvent:] (in AppKit)
-[NSControl mouseDown:] (in AppKit)
-[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] (in AppKit)
-[NSCell trackMouse:inRect:ofView:untilMouseUp:] (in AppKit)
-[NSCell _sendActionFrom:] (in AppKit)
-[NSControl sendAction:to:] (in AppKit)
-[NSApplication sendAction:to:from:] (in AppKit)
_ffi_closure_ASM (in _objc.so) (darwin_closure.S:95)
_ffi_closure_helper_DARWIN (in _objc.so) (ffi_darwin.c:703)
_method_stub (in _objc.so) (libffi_support.m:479)
_PyObject_Call (in Python)
_pysel_call (in _objc.so) (selector.m:941)
_PyObject_Call (in Python)
_PyFunction_SetClosure (in Python)
_PyEval_EvalCodeEx (in Python)
_PyEval_EvalCode (in Python)
_PyEval_GetFuncDesc (in Python)
_PyEval_GetFuncDesc (in Python)
_PyObject_Call (in Python)
_objcsel_call (in _objc.so) (selector.m:517)
_PyObjCFFI_Caller (in _objc.so) (libffi_support.m:1300)
_ffi_call (in _objc.so) (ffi_darwin.c:404)
_ffi_call_DARWIN (in _objc.so) (darwin.S:121)
-[NSArrayController _insertObject:atArrangedObjectIndex:objectHandler:]
(in AppKit)
-[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
(in AppKit)
-[NSController _notifyObserversForKeyPath:change:] (in AppKit)
-[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:]
(in Foundation)
-[NSSelectionBinder observeValueForKeyPath:ofObject:change:context:] (in
AppKit)
-[NSValueBinder _observeValueForKeyPath:ofObject:context:] (in AppKit)
-[NSSelectionBinder
_adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:]
(in AppKit)
-[_NSModelObservingTracker
setIndexReferenceModelObjectArray:clearAllModelObjectObserving:] (in AppKit)
___objc_error (in libobjc.A.dylib)
2006-03-27 21:10:28.899 Trigger[436] objc: FREED(id): message retain sent to
freed object=0x114d740


--
The extent to which an individual can resist being blindly led by tradition is a good measure of his vitality.  - Harry Partch

There is a computer disease that anybody who works with computers knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is that you 'play' with them! - Richard P. Feynman

Few people are capable of expressing with equanimity opinions which differ from the prejudices of their social environment.  Most people are not even capable of forming such opinions.  - Einstein

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to