Article View: comp.sys.amiga.tech
Article #13032Re: Locking & forbiding
From: Chuck McManis
Date: Thu, 08 Jun 1989 01:02
Date: Thu, 08 Jun 1989 01:02
43 lines
2423 bytes
2423 bytes
I wrote :
>Why don't you use SetWindowTitle()?
In article <d2YG02GD32Hm01@amdahl.uts.amdahl.com> (Dave Lowrey) writes:
>I need to get the address of the current title, as well as
>setting a new title.
>
>So I guess I am asking if it is safe to access this info
>without any locking.
Hmmmm, why do I get the feeling that you aren't doing something that
one my consider "normal" programming practice? :-)
So to be completely blunt and open about this :
You opened a window, so you have a pointer to the window. You
can use SetWindowTitles() to change it to whatever you want.
No locking required because you are the only one who will be
playing with your window title. Further you could cache
Window->Title before you set the title so that you restore
the title that you originally had on the window, or of course
you could just use the same pointer that you gave in the
NewWindow structure.
There is of course the "hack" case, which is to say you have
a pointer to a window that you did not open and do not own.
In which case you have absolutely no business at all mucking
with it's title because there is no locking mechanisim in the
world that can protect you from the application who actually
owns the window and might do any arbitrarily legal thing, like
substituting the title and calling FreeMem() on the pointer
that was in there. And if you had stuffed in some bogus title
the Application will have quite legally freed your memory for
you and you and it both will probably crash.
By the way, I couldn't find any reference in IntuitionBase that had
to do with titles anyway. Where were you looking?
--Chuck McManis
uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.
"A most excellent barbarian ... Genghis Kahn!"
Technical Details
Message-ID:
<108749@sun.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!sun-barr!sun!pepper!cmcmanisReferences:
<7cBq029532iy01@amdahl.uts.amdahl.com> <108333@sun.Eng.Sun.COM> <d2YG02GD32Hm01@amdahl.uts.amdahl.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!sun-barr!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: Locking & forbiding Message-ID: <108749@sun.Eng.Sun.COM> Date: 8 Jun 89 01:02:07 GMT References: <7cBq029532iy01@amdahl.uts.amdahl.com> <108333@sun.Eng.Sun.COM> <d2YG02GD32Hm01@amdahl.uts.amdahl.com> Sender: news@sun.Eng.Sun.COM Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 43