Thursday, 15 August 2013

0xC0000005: Access violation reading location 0x4effffff

0xC0000005: Access violation reading location 0x4effffff

This problem got me crazy, I have searched in web but couldn't find any
answer related to my problem . The error is this:
Unhandled exception at 0x7726dfe4 in GraphSimulation.exe: 0xC0000005:
Access violation reading location 0x4effffff.
I have a main project called GraphSimulation which simulates a network.
This GraphSimulator generates a network object.
class CNetwork
{
private:
CNetObjList<SNode> nodeList;
CNetObjList<SArc> arcList;
CNetObjList<SMovie> movieList;
CNetObjList<SOrder> orderList;
CNetObjList<SMoviePartMonitor> moviePartList;
CNetObjList<SFinishedOrder> finishedOrderList;
CNetObjArray<SMoviePartPath> moviePartPathArray;
CNetObjArray<SMoviePartMovmentMonitor> moviePartActionArray;
TimeUnit globalTimeCounter;
unsigned long globalStepCounter;
unsigned long timeUnitStepCounter;
unsigned long lastTimeUnitStepCounter;
NetworkObjectCode codeGenerationCounter;
vector <string> HBInfo;
SStatisticsMonitor statisticMonitor;
bool bManageCashAlone;/*if the nodes cash
manage them self
or if the progremer
manage the node
cash*/
private:
void TrySendingMoviePartsOnPath();
void InitActionArrayWithNetwork();
public:
void SetHalfBallInfo( string );
vector<string> GetHalfBallInfo();
and I have another project which is the algorithm for the network to help
how to distribute movies.
I need to set some information when algorithm runs.
string s = "some information";
network.SetHalfBallInfo(s);
SetHalfBallInfo stores this information in HBInfo; and I need to display
it in GUI when algorithm finishes running. So GetHalfBallInfo calls the
information.
m_HalfBallInfo = _network.GetHalfBallInfo();
//showing the movie parts list
CListBox* pSolutionDisplayList = (CListBox*)GetDlgItem(IDC_SOLUTION_LIST);
for(int i = 0 ; i < m_HalfBallInfo.size() ; ++ i )
{
CString str;
str.Format("%u " , m_HalfBallInfo[i]);
pSolutionDisplayList->AddString(str);
}
But it crashes when I return network before starting algorithm run.
CNetwork CGraphView::ConvertGraphToNetwork()
{
CNetwork network;
CGraphDoc *pDoc = GetDocument();
CGraph *pGraph = pDoc->GetGraph();
//must be in that order or the network will reject the data!!!
//=============================================================
SDialogParams* pDlgParam = pGraph->GetDialogParam();
CArray<NetworkObjectCode> movieCodeArray;
pDlgParam->movieList.GetNetworkObjectsCodes(&movieCodeArray);
for(int i = 0 ; i < movieCodeArray.GetSize() ; ++i)
{
CMovieWrapper currMovieWrapper;
pDlgParam->movieList.GetNetworkObject(movieCodeArray[i] ,
&currMovieWrapper);
network.AddMovie(currMovieWrapper.GetMovieCopy());
}
CMapWordToOb* nodeMap = pGraph->GetMapNodes();
POSITION pos = nodeMap->GetStartPosition();
while(pos != NULL)
{
CNode* pNodeObj;
WORD key;
nodeMap->GetNextAssoc(pos , key , (CObject *&)pNodeObj);
if(pNodeObj->GetCode() != InvalideCode)
{
SNode node = pNodeObj->GetNodeCopy();
network.AddNode(node);
}
}
CMapWordToOb* arcMap = pGraph->GetMapEdges();
pos = arcMap->GetStartPosition();
while(pos != NULL)
{
CEdge* pArcObj;
WORD key;
arcMap->GetNextAssoc(pos , key , (CObject *&)pArcObj);
SArc arc = pArcObj->GetArcCopy();
network.AddArc(arc);
}
CArray<NetworkObjectCode> orderCodeArray;
pDlgParam->orderList.GetNetworkObjectsCodes(&orderCodeArray);
for(int i = 0 ; i < orderCodeArray.GetSize() ; ++i)
{
COrderWrapper currOrderWrapper;
pDlgParam->orderList.GetNetworkObject(orderCodeArray[i] ,
&currOrderWrapper);
network.AddOrder(currOrderWrapper.GetOrderCopy());
}
return network;
}

No comments:

Post a Comment