ali@polya.Stanford.EDU (Ali T. Ozer) (04/16/89)
In article <10013@orstcs.CS.ORST.EDU> Bryce Jasmer writes: > > static NXDefaultsVector myDefaults = { > {"Misc", "1234"} > }; > > NXRegisterDefaults("MyApp", myDefaults); > >Using the debugger, I found that the segmentation fault happens within a >"strcmp" in the source file defaults.c ... Looking at the above code, there's no way for NXRegisterDefaults to know when to stop reading your array. You need to put a NULL at the end of your list as a default name: {"Misc", "1234"}, {NULL} Ali Ozer, NeXT Developer Support aozer@NeXT.com
avie@wb1.cs.cmu.edu (Avadis Tevanian) (04/17/89)
In article <10013@orstcs.CS.ORST.EDU> jasmerb@mist.CS.ORST.EDU (Bryce Jasmer) writes: >I am trying to make use of the "defaults database" within a program that >I am writing and am having a little bit of trouble with it. I am getting >a segmentation violation when I make a call to "NXRegisterDefaults". >+initialize >{ > static NXDefaultsVector myDefaults = { > {"Misc", "1234"} > }; > > NXRegisterDefaults("MyApp", myDefaults); > return self; >} You need to NULL terminate the list of defaults. Try: static NXDefaultsVector myDefaults = { {"Misc", "1234"}, { NULL, NULL} }; I will tell our documentation people to make this clear in the TechDoc (the example there in 0.8 documentation has the same problem). -- Avadis Tevanian, Jr. (Avie) Chief Operating System Scientist NeXT, Inc. avie@cs.cmu.edu or avie@NeXT.com -- Avadis Tevanian, Jr. (Avie) Chief Operating System Scientist NeXT, Inc. avie@cs.cmu.edu or avie@NeXT.com --