FROM : Nick Zitzmann
DATE : Sun Jan 13 19:07:03 2002
On Sunday, January 13, 2002, at 06:13 PM, Jon wrote:
> I have run into a problem with deleting an object from an
> NSMutableArray. Watching it in the debugger, I have found that
> the object is removed just fine its when the NSTableView gets
> reloaded that my program will crash with "... exited due to
> signal 10 (SIGBUS)." looking at the "Frame" in the debugger
> view it top calls are -[NSCell _setContents:] -[NSCell
> setObjectValue:] up to the NSTableView.
Is your application multithreaded?
I wrote a multithreaded application, and I was struggling with
the same problem. As it turns out, the NSTableView's
objectValueForTableColumn function runs in the original thread
of an application, and I was modifying the NSMutableArray in my
spun off thread while objectValueForTableColumn was running in
the first thread. Which, of course, caused a crash.
I solved the problem by defining an NSLock, locking and
unlocking the NSLock before touching the array in the spun off
thread, and using the "tryLock" procedure in the
objectValueForTableColumn function. In the case that tryLock
couldn't get a lock, I just made the column read "Loading,
please wait" until it would run again, and then hopefully get a
lock and insert the real value.
If your application's single threaded, well, that may or may not
be the problem... <shrug>
Nick Zitzmann
ICQ: 22305512
"Democracy is a very delicate tool, and if you try to impose
democracy without the basic civil society that supports it, you
get yourself into a serious problem." - Edward Walker, former US
Assistant Secretary of State for Near Eastern Affairs (2000-2001)
DATE : Sun Jan 13 19:07:03 2002
On Sunday, January 13, 2002, at 06:13 PM, Jon wrote:
> I have run into a problem with deleting an object from an
> NSMutableArray. Watching it in the debugger, I have found that
> the object is removed just fine its when the NSTableView gets
> reloaded that my program will crash with "... exited due to
> signal 10 (SIGBUS)." looking at the "Frame" in the debugger
> view it top calls are -[NSCell _setContents:] -[NSCell
> setObjectValue:] up to the NSTableView.
Is your application multithreaded?
I wrote a multithreaded application, and I was struggling with
the same problem. As it turns out, the NSTableView's
objectValueForTableColumn function runs in the original thread
of an application, and I was modifying the NSMutableArray in my
spun off thread while objectValueForTableColumn was running in
the first thread. Which, of course, caused a crash.
I solved the problem by defining an NSLock, locking and
unlocking the NSLock before touching the array in the spun off
thread, and using the "tryLock" procedure in the
objectValueForTableColumn function. In the case that tryLock
couldn't get a lock, I just made the column read "Loading,
please wait" until it would run again, and then hopefully get a
lock and insert the real value.
If your application's single threaded, well, that may or may not
be the problem... <shrug>
Nick Zitzmann
ICQ: 22305512
"Democracy is a very delicate tool, and if you try to impose
democracy without the basic civil society that supports it, you
get yourself into a serious problem." - Edward Walker, former US
Assistant Secretary of State for Near Eastern Affairs (2000-2001)
| Related mails | Author | Date |
|---|---|---|
| Jon | Jan 13, 18:14 | |
| Nick Zitzmann | Jan 13, 19:07 |






Cocoa mail archive

