Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SysFatalAlert,MemoryMgr.c, Line:4384, Free Handle - Urgent

Posted on 2004-11-08
3
Medium Priority
?
3,426 Views
Last Modified: 2012-08-13
Hi,

SysFatalAlert,MemoryMgr.c, Line:4384, Free Handle
when I called the below function, it gives the above error message.
Please give solution for this.
Thanks in advance
Boolean tablePopulationFunction()
{
      LocalID                        dbID = NULL;
      DmOpenRef                   dbRef= NULL;
      MemHandle                  mhRecHandle = NULL;
                  
      JOBINFO*                  stJobInfoP = 0;
      CARTRIDGES* stCartInfoP = 0;
            
      //get the Pointer of the Table
      TablePtr tblP = ( TablePtr ) GetObjectPtr( JobAssignmentLocationTable );
      //for the Row of the Table.
      int                         iRow = 0;
      //for the column of the table.
      int                         iCol = 0;
      //Get the number of rows in the Table.
      int                         iRows = TblGetNumberOfRows( tblP );
      //Get the Number of Items in the Table.
      int                         iNumItems = giEndIndex - giStartIndex;
      int                         iCounter = 0;
      //for the Total Number of Records in the Database.
      int                         iNumRecordsInDatabase = 0;
            
      ErrTry
      {
            tblP = ( TablePtr ) GetObjectPtr( JobAssignmentLocationTable );
             TblHasScrollBar( tblP, true );
            TblEraseTable( tblP );
            TblMarkTableInvalid ( tblP );

            int      iNumRecordsinDatabase = 0;                  

                  dbID = DmFindDatabase( 0,JOBINFODB );      
                  if( dbID == 0 )
                  {
                        FrmCustomAlert( ErrorAlert,NODATABASE," " ," "  );      
                        closeApplication();
                        return false;
                  }
                  dbRef       = DmOpenDatabase( 0, dbID, dmModeReadOnly );
                  if(dbRef == 0)
                  {
                        FrmCustomAlert( ErrorAlert,DATABASEOPENPROB," " ," "  );      
                        closeApplication();
                        return false;
                  }

                  iNumRecordsInDatabase = DmNumRecords( dbRef );
                  iNumItems = iNumRecordsInDatabase;

                  for( int iRowCtr = 0;  iRowCtr < iRows; iRowCtr++ )
                  {
                        TblSetRowUsable( tblP, iRowCtr, false );
                  }
                  iNumRecordsInDatabase = DmNumRecords(dbRef);

                  int iCtr = 0;
                  
      for( int idx = giStartIndex; idx  < giEndIndex && idx < iNumRecordsInDatabase; idx++ )
                  {

                        mhRecHandle = DmQueryRecord( dbRef, idx );
                        if(mhRecHandle == NULL)
                        {
                              FrmCustomAlert(ErrorAlert,RECORDGETTING," " ," ");
                              DmCloseDatabase(dbRef);
                              return false;
                        }
                                                
                        Err err2 = DmGetLastErr();                                          
                        stJobInfoP = ( JOBINFO * ) MemHandleLock( mhRecHandle );
                        Err err3 = DmGetLastErr();
                        
                                                
                        //set the data for the iRow that is the location.
                        TblSetRowUsable( tblP, iRow, true );
                        TblSetColumnUsable ( tblP, iCol, true );
                        TblSetItemStyle( tblP, iRow, iCol, labelTableItem );
      TblSetItemPtr( tblP, iRow , iCol , ( char* )stJobInfoP->cFunctionLocationId );
                        
                        //now increment the iCol int to point to the next row
                        //This is for the Job Type Column.
                        TblSetRowUsable( tblP, iRow, true );
                        TblSetColumnUsable ( tblP, iCol + 1, true );
                        TblSetItemStyle( tblP, iRow, iCol + 1, labelTableItem );
                        if(giJobType == 1 || giJobType == 4)
                              TblSetItemPtr( tblP, iRow , iCol + 1 , ( char* )stJobInfoP->cAtmType );
                        else
                              TblSetItemPtr( tblP, iRow , iCol + 1 , ( char* )stJobInfoP->cJobType );
                        
                        //now increment the iCol int to point to the next row
                        
                        //This is for the Status Column.
                        TblSetRowUsable( tblP, iRow, true );
                        TblSetColumnUsable ( tblP, iCol + 2, true );
                        TblSetItemStyle( tblP, iRow, iCol + 2 , labelTableItem );

                        //Here we check if teh Job has been completed or not.
                        if( stJobInfoP->bSavedStatus)      
                        {
                              TblSetItemPtr( tblP, iRow , iCol + 2 , (char*)"C" );
                        }
                        else
                        {
                              TblSetItemPtr( tblP, iRow , iCol + 2  , (char*)"P" );
                        }
                        if (mhRecHandle != NULL )
                        {
                              MemHandleUnlock( mhRecHandle );
                        }                  
                        //increment counters for the array  and for the iRow
                        
                        iCtr++;
                        iRow++;
                  }                                    
                  DmCloseDatabase( dbRef );
                        
                  
            tblP = ( TablePtr ) GetObjectPtr( JobAssignmentLocationTable );
            TblDrawTable( tblP );
            
            stJobInfoP = NULL;            
      }
      ErrCatch(err ){
            ErrDisplay("Error");
      }ErrEndCatch
      
      return true;
}
0
Comment
Question by:yasoda
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 2000 total points
ID: 12523367
which line gives you the error?

One solution is

you are using two handles, but, only one variable

2) your writing to a Object thats closed
0
 

Author Comment

by:yasoda
ID: 12524411
Hi,
it is giving error in the stJobInfoP = ( JOBINFO * ) MemHandleLock( mhRecHandle );

Err err2 = DmGetLastErr();                                  
stJobInfoP = ( JOBINFO * ) MemHandleLock( mhRecHandle );
Err err3 = DmGetLastErr();

waiting for ur reply
Thanks in advance
adesh
0
 

Author Comment

by:yasoda
ID: 12530395
Hi,
it is giving error in the stJobInfoP = ( JOBINFO * ) MemHandleLock( mhRecHandle );

Err err2 = DmGetLastErr();                                  
stJobInfoP = ( JOBINFO * ) MemHandleLock( mhRecHandle );
Err err3 = DmGetLastErr();

Thanks in advance
adesh
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to setup the internet connectivity on Windows Mobile Emulator.   I assume that you already have Microsoft Visual Studio, Microsoft Windows Mobile SDK's and the emulator installed. The emulator is available with Visual Studi…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question