-1

I am getting runtime error on one of the machine. I have test my application on hundred of machine but not getting any kind of error. error window is shown below.

when crash the application shows error windows, enter image description here

and if i click on clickhere link it shows below image. enter image description here

and if I debug the code then it shows below image. enter image description here

I don't know it is problem in my code or any problem in OS installation please help me. because my application runs everywhere and on all OS but getting error in only one of the computer.

code is given below:

rem->m_operationInProgress = false;
delete rem;  // from where error occur.
printf("after deleted.."); //this is not execute.

and destructor is:

test::~test()
{
        printf("\n Enter in destructor.. ");

//  
//  m_isRunning = false;
//  Sleep(1000);

//  //-------------------------------------------- 1_4_2012
//  printf("\nCalling m_dataCollection->shutDown()");
////    printf("\n****calling  m_connect.shutDown();****");
//      printf("\nRPA :: 11....");
//  m_connect.shutDown();
//      printf("\nRPA :: 12....");
//  //printf("\n****after m_connect.shutDown();****");
//          printf("\nRPA :: 13....");
//  if(m_device != NULL)
//  {
//      //printf("\n****before delete  m_device;****");
//      printf("\nRPA :: 14....");
//      delete m_device;
//      printf("\nRPA :: 15....");
//      //printf("\n****after delete  m_device;****");
//  }
printf("\n Exited from destructor.. "); // this is also print on console.

}

it successfully execute both print f then crashed.

yogesh patel
  • 375
  • 3
  • 9
  • 20

1 Answers1

1

Can you tell us the difference between the machine you are testing on and the 'hundreds of machines' you have tested on? Your app seems to be multithreaded, and setting the operation-in-progress to false does not seem to immediately tell all threads to exit, especially if the computer under test is slow and single-core. So you probably prematurely deletes the pointer, while other threads are still using it. Hence the reason why the destructor is called, but then a slow thread wakes up somewhere and tries to use the pointer, that had long been deleted.

You probably need to add lock on the pointer to ensure that it is not deleted until all threads have exited.

maress
  • 3,533
  • 1
  • 19
  • 37
  • I thought that may be the issue and i commented all of the thread which are executing. but then also giving the same problem.and this application is tested on all type of machine like windows xp,windows 7 ,windows vista and having 512 to 3GB ram. but not getting error. – yogesh patel Apr 25 '12 at 09:08
  • the only time i got into this absurd problem was because of threading. Probably there are other causes out there – maress Apr 25 '12 at 12:20