Hi All,
> 
> I have a form in which I have 13 fields. When the
> user enters the data, I store them in the structure
> variables when the user wishes to go to next form,
and I restore the field contents when he comes back to
the screen.
> 
> Also I have a 'clear' button in the form which
> clears all the field contents.
> 
> The problem is ,When I run the gremlin session, I
> get
> "Minor error found while exiting the application.
> Unfreed chunk at 0x00005CF0. (owner ID of 2)".
> 
> I successfully solved couple of crashing
> problems(Thanks a lot for the latest pose which
> pinpointed where the problem was), but I got stuck
> here.
> 
> I have enclosed part of my code where I am handling
> field related events. I have been struggling to
> solve
> this problem since 2 days , but am stuck. COuld
> anyone
> throw some light as to  where I am going wrong so
> that
> I can proceed with my testing.
> 
> 
>  //If More button is clicked, grab all the data from
> the form, validate and move to the next form.
> 
> case InputPara1MoreButton:
>                 
> if(InputData_st.dstMethod_e == Direct) {
>                   
> //Grab the info from the text field.
> fld1 = (FieldType *)FrmGetObjectPtr(frmP,
> FrmGetObjectIndex(frmP, SiteSepField));
>                  
> if(fld1) {
>   siteSepP = FldGetTextPtr(fld1);
>                        
>   //If there is data entered in this field,
>   if(siteSepP) {
>     StrNCopy(InputData_st.siteSep_arr_15, siteSepP, 
 sizeof(InputData_st.siteSep_arr_15));

>  InputData_st.siteSep_arr_15[14] = NULL;

> //Convert the data to double.
> strToDouble(siteSepP, &InputData_st.siteSep_f);
> }
> }   
> 
> //Please note: Here fld1 is a global var and
> siteSepP
> is a local var. 
> 
> 
> //Here is how I restore the contents of the field.
> when the form opens up.
> 
> if((InputData_st.dstMethod_e == Direct) && fld1) {

>  txtH =
> MemHandleNew(StrLen(InputData_st.siteSep_arr_15) +
> 5);

> p = (char *)MemHandleLock(txtH);
>   StrCopy(p, InputData_st.siteSep_arr_15);
  
>   MemHandleResize(txtH, StrLen(p)+1);

>   MemHandleUnlock(txtH);
> 
>   // fld1 = (FieldType *)FrmGetObjectPtr(frmP,
> FrmGetObjectIndex(frmP, InputPara1SiteSepField));

>         oldHandle = FldGetTextHandle(fld1);

>         FldSetTextHandle(fld1, txtH);
>         FldDrawField (fld1);    //draws the contents
> of the field.
>         if (oldHandle)
>            MemHandleFree(oldHandle);            
>  
>     }
> 
> 
> //Here is the code for clearing the contents of the
> field.
> fld1 = GetObjectPtr (IputPara1SiteSepField);
 
  txtLen_u16 = FldGetTextLength(fld1);
  if (txtLen_u16 > 0) {
>  butID = FrmGetObjectIndex(frmP, SiteSepField);

> //Hide the button when the form opens up.
>  FrmHideObject(frmP, butID);
>       
>  txtH = FldGetTextHandle(fld1);
>  FldSetTextHandle(fld1, 0);

>  if(txtH) {
>     errFreeMem = MemHandleFree(txtH);
>         
>  }
>  FrmShowObject(frmP, butID);
 }
> 
> PS : I am not doing anything (like freeing memory)
> when closing the form or while exiting the
> application.
> 
> Thanks in advance for your time and patience.
> 
> Regards,
> Ammy


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to