Path: utzoo!attcan!uunet!husc6!mit-eddie!mit-amt!phil From: phil@mit-amt.MEDIA.MIT.EDU (Phil Sohn) Newsgroups: comp.sys.mac.programmer Subject: A strange MPW bug (mine, not Apple's) Message-ID: <2554@mit-amt.MEDIA.MIT.EDU> Date: 31 May 88 19:40:10 GMT Organization: MIT Media Lab, Cambridge, MA Lines: 49 I have a really wierd bug, does anyone have an idea what is going on? In the following code segment there are two bugs. The first one is I can not seem to get a string back out of a structure once I put it there. The second one is DebugStr does not seem to work like I think it should. The first and second calls to DebugStr prints the correct error message in MacsBug, but the third prints almost garbage (instead of printing the string that is determined at compile time, it prints part of the title that was passed in as an argument, and then a procedure name that is defined elsewhere.) I assume that the string pool is getting screwed someplace, but I can not find where. The files are compiled with the -g option, and I assume that is where the procedure name is comming from. I assume the contrlTitle of the control returned by NewControl is a Pascal String. I can not seem to get this sting back after the call. short Make_ScrollBar(ctrl,win,x,y,w,h,title,val,min,max) ControlHandle *ctrl; WindowPtr win; short x,y,w,h,val,min,max; char *title; { ControlHandle c; Rect r; DebugStr("The struct title is "); /* This print correctly */ r.top=y; r.left=x; r.bottom=y+h; r.right=x+w; DebugStr(strcat("On entry title is ", title)); /* This to */ DebugStr("The struct title is "); /* This prints garbage i.e. the value of title followed by ssssDrawScrollBar() */ c = NewControl(win,&r,title,true,val,min, max,scrollBarProc,(long)scrollBarProc); DebugStr(p2cstr((*c)->contrlTitle)); /* this is where the first bug is shown. Shouldn't p2cstr((*c)->contrlTitle return title which was passed to NewControl? */ if(c) { *ctrl = c; return(true); } else return(false); } Thanks for any help you can provide. Arpa: phil@ems.media.mit.edu