I am trying to preserve the original value of an object for use at each iteration of a loop, however on when the elements are deleted which are only in scope of the loop, I get an error which says: "Invalid Address specified to RtlFreeHeap." I can't figure out what I am doing wrong.
Here is a sample of my code:
Note this code works properly if I change the dataGraph definition to:Code:void mainTest (Graph_ptr _dataGraph) { Graph originalDataGraph = (*_dataGraph); for(int i=0; i<10; i++) { Graph dataGraphCopy = originalDataGraph; Graph_ptr dataGraph = Graph_ptr(&dataGraphCopy); // do some other things } }
However, by doing this, I lose the original value of the dataGraph which I need at the start of each loop iteration. Also, Graph_ptr is just a boost pointer of type Graph.Code:Graph_ptr dataGraph = _dataGraph;
What could be the problem?
Thanks.




Reply With Quote