Reprint user breakpoint called from code at * * *
New and delete are not necessarily paired.
At runtime, delete "User breakpoint called from Code at * * *". Think it should be a pointer before the delete, here again delete once, find an afternoon ... Both the new and the delete are paired and there is no problem. But it was a mistake.
Later on the Internet, it is possible that some kind of destructor, the invisible Delete. I don't know if this is understood here. But I also checked, still do not think there is any problem.
After a piece of code a code comment, and then see which section has a problem, found a function call, used to:
void Cdlgcurveanalys::D istanceradius (int num, double *pdistance, int *pobjradius, int *precradius)
{
if (Pobjradius)
{
memset (pobjradius,0,sizeof (double) *num);
}
***************************
}
It was found that, as a result of the need, the definition of Pobjradius was defined as double*, so memset was also used by sizeof (double), but later changed to int, and did not notice that the assignment exceeded the bounds of the pointer. Delete when the error.
This check also reminds me that after the pointer delete to remember to assign null, convenient later use, to determine whether the pointer was used. This question before asked seniors, but only know that when not assigned to NULL, will be a wild pointer, but do not know why. It's been a tough time. Next time Remember ~
So in general, the delete report "User breakpoint called from Code at * * * * * *", the first time to consider the points
1. New and delete corresponding
2. Be careful about the destruction of classes (stealth delete)
3. Pointer assignment is to pay attention to the size of the pointer request, do not cross
4. After delete, remember null.
Another problem to be solved is: delete[]pdis; how does the compiler know how many pointers to delete? In this case, I suspect that when the assignment crosses the line, the delete[] should be the place where the delete crosses the boundary. I don't know, look at other books.