I have a programming dilemma....
I have defined an array
typedef struct {
long value;
CharPtr text;
} MyType;
MyType MyArray[10];
To set the text property, I ...
MyArray[0].value = 5;
VoidHand h = MemHandleNew(StrLen("Bob") + 1);
CharPtr s = MemHandleLock(h);
StrCopy(s, "Bob");
MyArray[0].text = s;
MemHandleUnlock(h);
Now, I get away with that. But, when I want to use 'text' again later...
VoidHand h = FldGetTextHandle(someField);
CharPtr s = MemHandleLock(h);
StrCopy(s, MyArray[0].text); <<<<<<<<<<<<< Error: Accessing unlocked
memory
MemHandleUnlock(h);
I get the indicated error when using POSE (which is great, because it picks
up errors that
my have gone undetected!)
Can someone please correct me, and get me over this problem. There is a
strong chance that
I have taken a poor approach to this, and there is a much better and correct
method.
Please! and Thanks!
Jason