[comp.sys.mac.programmer] TESetText moving LOCKED handles

engber@gumball.ils.nwu.edu (Mike Engber) (02/25/90)

I'm using THINK C 4.0 and my call to TESetText moves my TEHandle,
even though it's been locked.

    ...
    TEHandle	editHan;	
    TEPtr	editPtr;
    ...
    editHan	= TENew(&textRect,&textRect);
    MoveHHi(editHan);
    HLock(editHan);
    editPtr = *editHan;
    ...
    TESetText(textPtr,textLength,editHan);
		
At this point editPtr and *editHan have different values (viewed through
the debugger) Restoring editPtr with editPtr = *editHan; right after the
call to TESetText fixes things up, but why? I also tried putting an extra
call to HLock right before the call to TESetText just in case editHan
was somehow getting unlocked - no dice.
		
In summary, when I fix up my code to assume that TESetText will move the
handle, it works fine. But according to what I've read, I shouldn't have
to do things like this. Is this documented is some Tech Note or something.

Please respond via email if possible.

-ME