[Pyobjc-dev] AhA! A clue!
Brought to you by:
ronaldoussoren
From: Bill B. <bb...@co...> - 2002-10-24 03:52:51
|
If I change this... class TestNSArrayInteraction( unittest.TestCase ): def testNSArrayAllocation( self ): NSCountFrames() for i in range(1,1000): print "c: %s" % i a = NSArray.array() b = NSArray.alloc().init() ... to this ... class TestNSArrayInteraction( unittest.TestCase ): def testNSArrayAllocation( self ): NSCountFrames() for i in range(1,1000): print "c: %s" % i a = NSArray.array() b = NSArray.array() ... the unit test passes! The first test crashes during the second pass through the loop and, once crashed, the stack is trashed. Changing the test to... class TestNSArrayInteraction( unittest.TestCase ): def testNSArrayAllocation( self ): NSCountFrames() for i in range(1,1000): print "c: %s pre alloc()" % i a = NSArray.alloc() print "c: %s pre init()" % i a.init() ... spews this output: [bumbox:~/bbum-developer/sourceforge/pyobjc] bbum% python Lib/Foundation/test/test_nsobject.py c: 1 pre alloc() c: 1 pre init() c: 2 pre alloc() c: 2 pre init() Segmentation fault So -- it is during the second time that the bridge attempts to invoke -init that it crashes. Specifically, when the NSInvocation object's -invoke method is fired. (I'm debugging "out loud" now -- hoping that someone will chime in w/an "oh, yeah, that's easy!" :-) b.bum |