Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Deleting a array of structures is throwing invalid pointer exeption.

$
0
0

I have a server code written in VC. In the destructor of a calss i am trying to delete a array, system is throwing a invalid pointer exception.This issue is seen in Linux only.

The same code is below

Struct ActionType
{
   ActionType()
  {
     Code=0;
     active=false;
     pnwWriter=0;
  }

  ~ActionType()
  {
  if(pnwWriter)
    delete pnwWriter;
  }
  double code;
  bool active;
  PnwWriter *pnwWriter

}

Inside class

m_Obj=new ActionType[Count];

after this i am adding few values to it. Then in destructor i am trying to delete m_obj like

if(m_Obj)

delete[] m_obj;

When we execute this line system is throwing Invalid pointer exception. Please suggest me how can i resolve this problem.


Veeresh Angadi


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>