Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!carp.cis.ohio-state.edu!brown-t From: brown-t@carp.cis.ohio-state.edu (ted croft brown) Newsgroups: comp.sys.mac.programmer Subject: "bus error" on GetPort Message-ID: <85692@tut.cis.ohio-state.edu> Date: 6 Nov 90 00:43:07 GMT Sender: news@tut.cis.ohio-state.edu Reply-To: ted croft brown Distribution: usa Organization: Ohio State University Computer and Information Science Lines: 44 I have come across a probelem that has me REALLY confused. I am programming in THINK C 4.02. I am in the process of writting my first Macintosh C program (and it's been *educational*). Anyway, in writting Modal dialogs I do... HandleMenuCommand() { WindowPtr window . . GetPort(window); DoDialogRoutine(); SetPort(window); } My code runs at home on my Mac SE (1 MB) but not on the IIci (8MB, 80MBHD, Multifinder) here at the lab. I ran the debugger, and I get a "bus error" at the GetPort(window); I set a break point before the GetPort and right after it and it "bus error"`s when I tell it to step to the GetPort. The WindowPtr is not NULL (it consistently came up as AC40000 or something like that I can`t remember of the top of my head. I use the same lines elsewhere and the WindowPtr there came up as AC000000. Any idea what might be wrong? The code works fine on my SE. I changed the local window variable to a global gWindow and now it works perfectly on the SE and the IIci. It's not so much as it won't work, but I don't understand why it works one way and not the other. The SAME code lines work elsewhere in the program on BOTH machines. I feel like I must have misunderstood something very basic here and would appreciate any help, thoughtfull insight, gratutious donations of money to help ease the mental anguish... Sorry about wasting the bandwith..but I am CONFUSED. I hope I have included enough information to get some usefull advise. I will take help/advise any way I can get it (net/email/etc etc) Ted Brown