I have figured it out. Im blind.
> Handle = DmNewRecord(PeriodDB, (UInt*)&Record,1);
> err=DmGetLastErr();
> err=DmReleaseRecord(Handle,0,true);
^^^ should be DB pointer not handle!
There you go. I couldnt see the forest because of all the
trees in the way.
Mike
----Original Message Follows----
From: "Mike LaPaglia" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Codewarrior R5 C++ question.
Date: Wed, 20 Oct 1999 22:32:47 PDT
Yeah, the record=0 lines is there as a a test, to override the
possability of a stack overrun. After I set
the a6 stack frames the stack wasnt getting trashed.
and after checking with the debugger, the Handle is valid.
0x90018256 is the value this time, which I think is valid
compared with other Handles throughout the program.
BTW, the function arguments are valid with what is sent in.
I have been testing on the emulator with the debug rom.
I get similar results with the downloaded hardware rom.
I am thinking there must be some switch or setting not set correctly but I'm
befuddled.
Thanks for looking at this.
Mike
----Original Message Follows----
From: "Roger Chaplin" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Codewarrior R5 C++ question.
Date: Wed, 20 Oct 1999 22:41:39 -0400
"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]>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com