home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / Misc / HigherEducationMailbox.mbox / Archives_provide_val_.attach / May_91 / appkit.337 < prev    next >
Text File  |  1991-05-21  |  1KB  |  38 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f2\fmodern Courier;\f1\fswiss Helvetica;}
  2. \paperw11760
  3. \paperh7200
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ul0\fs28\fc0 PrintInfo strlen\
  8. \
  9. Q:  I try to create a new PrintInfo (other than the one created by the AppKit) by doing a simple 
  10. \b [PrintInfo new]
  11. \b0 ; however my app seg faults in that statement. Backtrace in gdb indicates a problem with 
  12. \b strlen
  13. \b0 ().      \
  14. \
  15. A:  PrintInfo tries to obtain the values for printer-related defaults such as NXPaperType, etc. In doing that it looks at the defaults registered under the application's current appname using:\
  16. \
  17.  
  18. \f2\fs24     NXGetDefaultValue([NXApp appName], "NXPaperType");\
  19.  
  20. \f0\fs28 \
  21. It then tries to use the returned values assuming they are valid strings.\
  22. \
  23. Normally the app will give itself values for all these default variables; however, the variables will be registered under the name the app had at +
  24. \b new
  25. \b0  time. Thus, if the programmer changes the name of the app for some reason (with 
  26. \b setAppName
  27. \b0 :, for instance), then the above function will return NULL as the value for the default. This will cause 
  28. \b strlen
  29. \b0 () to die a horrible death.\
  30. \
  31. \
  32. QA337\
  33. \
  34. Valid for 1.0\
  35. Not valid for 2.0\
  36. \
  37.  
  38.