Re: [Pyobjc-dev] Indexed Accessor use gives "Bus Error"
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2004-12-08 21:20:14
|
On 8-dec-04, at 20:58, Neil Martinsen-Burrell wrote: > On Dec 8, 2004, at 12:49, Bob Ippolito wrote: > >> On Dec 8, 2004, at 12:23 PM, Neil Martinsen-Burrell wrote: >> >>> I am having a problem implementing KVO-compliant indexed-accessor >>> methods using PyObjC. The problem is a "Bus Error" when the program >>> is run. The following seems to be a minimal reproduction of the >>> problem. This is on 10.3.6 with the default Python installation and >>> PyObjC 1.1. The nib simply contains an NSTableView with two columns >>> (with keys current and name) bound to an NSArrayController that is >>> bound to an instance of the following class (with contentArray = >>> TestList.list). The crash report generated follows the program >>> listing. Are index accessors not fully supported in PyObjC? Am I >>> mis-declaring the accessors? Thanks for any help you can give. >> >> countOfList should also be an objc.accessor (I think this is the >> reason for your crash) > > Indeed, this solves the bus error problem. All of the accessors > needed to be explicitly declared as such. If the accessors that are > supposed to return (void) are not objc.accessor's, then they raise an > error because they return the wrong type. But accessors such as > countOfList that return data do not raise errors if they are not > objc.accessor's, they just cause the Bus Error. Is this the desired > behavior? It's the way it is :-(. As Bob mentioned random crashes are a side-effect of passing objects of the wrong type to ObjC code that isn't very careful in checking method signatures. Ronald |