Re: SIGSEGV/SIGBUS in java cocoa app using NSComboBox and NSTableView
Re: SIGSEGV/SIGBUS in java cocoa app using NSComboBox and NSTableView
- Subject: Re: SIGSEGV/SIGBUS in java cocoa app using NSComboBox and NSTableView
- From: "Nick Emery" <email@hidden>
- Date: Tue, 15 May 2001 09:49:49 +0100
- Organization: Peramon technology Ltd
>
The table view isn't retaining the object you return from
>
objectValueForColumn, so they work the first time, until java calls gc()
>
and the objects go away.
>
>
Make sure that you keep a reference in java to anything you return to
>
the table view, so they won't get garbage collected and things will work
>
better.
>
>
I doubt this is the way apple wanted the java bridge to work in this
>
case, but I think this is a reasonable workaround.
hmm, ok i've stuffed all of the strings that i return to the table view
into a Vector. things seem to have changed slightly. i now get the following
messages when i trigger the action for the 2nd time in the ComboBox:
May 15 09:25:20 test[709] *** -[NSshortNumber searchAction:]: selector not
recognized
May 15 09:25:20 test[709] Exception raised during posting of notification.
Ignored. exception: *** -[NSshortNumber searchAction:]: selector not
recognized
on the 3rd trigger, it crashes again with a
test.app has exited due to signal 11 (SIGSEGV).
this looks to me like a classic case of a memory corruption, but i have not
written any c, c++ or obj-c that would do this kind of thing. i don't think
that you should be able to corrupt memory from java.
i've run the program using gdb rather than the java debugger, and the stack
backtrace looks like:
0 objc_msgSend
1 -[NSApplication sendAction:to:from:]
2 -[NSControl sendAction:to:]
3 -[NSTextField textDidEndEditing:]
4 _nsNotifictionCenterCallBack
5 _postNotification
6 _CFNotificationCenterPostLocalNotification
7 _CFNotificationCenterPostNotification
8 -[NSNotificationCenter postNotificationName:object:userInfo:flags:]
9 -[NSNotificationCenter postNotificationName:object:userInfo:]
10 -[NSTextView(NSPrivate) _giveUpFirstResponder:]
11 -[NSTextView(NSKeyBindingCommand) insertNewline:]
12 -[NSObject performSelector:withObject:]
13 -[NSResponder doCommandBySelector:]
14 -[NSTextView doCommandBySelector:]
15 -[NSInputContext _handlerCommand:]
16 -[NSKeyBindingManager(NSKeyBindingManager_MultiClient) interpretEvent
AsCommand:ForClient:]
17 -[NSTSMInputContext interpretKetEvents:]
18 -[NSView interpretKeyEvent:]
19 -[NSTextView keyDown:]
20 -[NSWindow sendEvent:]
21 -[NSApplication sendEvent:]
22 -[NSApplication run]
23 NSApplicationMain
24 main
25 _start
26 start
27 ??
all but main are greyed out so i can't see what the parameters are for the
various calls.
help!! --nikki