"Mike LaPaglia" <[EMAIL PROTECTED]> wrote:
> I think I figured out the lack of "this"
> I needed to set A6 stack frames. It appears to
> be sending the local variables to the debugger but now I found the
> real error. Apparently the program is causing
> a bus error when calling DmReleaseRecord() using the following:
I'm having a bit of trouble understanding your logic here. Annotations
follow:
> void Period::Store (Int Record)
> {
> Err err=0;
> char t[50];
> VoidHand Handle;
> StrIToA(t,(int)this);
>
> //i = (Int *)MemPtrNew(sizeof(Int));
>
> if ((Record == noRecordSelected)||(Record >= Count))
> { Record = Count;
> }
The previous three lines of code are totally redundant, because on the
next line,
> Record =0;
> Handle = DmNewRecord(PeriodDB, (UInt*)&Record,1);
> err=DmGetLastErr();
> err=DmReleaseRecord(Handle,0,true);
What are the arguments' values? Are you checking with the debugger?
> if (0==err)
> Pack(Record);
> //MemPtrFree(i);
> }
>
> The problem is pretty consistant. I have tried various forms
> but always get the Buss error on the console when the DmReleaseRecord
> is called.
>
> What is my malfunction here? It is code similar to other times
> I have used it and it works fine.
In general, when you allocate memory you should *always* check the
returned handle/pointer and bail out if it's NULL.
How far down in the call stack is this method? If you're overflowing
the stack, the Handle variable could be getting trashed.
--
Roger Chaplin
<[EMAIL PROTECTED]>