Acad2008 crash on arx unload

Acad2008 crash on arx unload

Anonymous
Not applicable
383 Views
3 Replies
Message 1 of 4

Acad2008 crash on arx unload

Anonymous
Not applicable

Hello!

Acad crashes on unloading arx application: shows message that arx have succesfully unloaded, then pauses, then just closes and tries to report an error. I've found out the problem is caused inside for loop (i.e. uncommenting solves the problem).

 

AcGePoint3dArray pCoord, pCoordCp;//hold all points' coordinates

...

double pointDistArray [42];

ads_point ap1, ap2;

.

...

for(inti=0; i<pCoord.length(); i++)//Acad crashes on unload arx also..

{

//pCoord gets damaged within here..?

ap2[0] = pCoord.at(i).x;

 

ap2[1] = pCoord.at(i).y;

 

ap2[2] = pCoord.at(i).z;

 

pointDistArray[i] = acutDistance(ap1,ap2);

 

acutPrintf(_T("\nDistance from base point to point %u is %f."), i, pointDistArray[i]);

}

...

 

Is conversion from AcGePoint3d to ads_point correct?

Debugging shows the pCoord array's physical length gets damaged after the loop.

 

Any thoughts?

 

Regards,

DL

0 Likes
384 Views
3 Replies
Replies (3)
Message 2 of 4

owenwengerd
Advisor
Advisor

Have you stepped thorugh the loop to determine why it crashes? What is the context when this code executes? I don't see any check to ensure that you don't index beyond the end of ointDistArray, so that should be the first suspect.

--
Owen Wengerd
ManuSoft
0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for the hint.

Apparently pointDistArray[] is ok. It is ensured it holds 42 distances according to pCoord length. I suspect it's because of the fact that pCoord's physical length is getting corrupted inside this loop.

0 Likes
Message 4 of 4

Anonymous
Not applicable

Solved!

Owen, you were right, this is because of the pointDistArray[] runs out of its bounds, thanks!

But what is strange,

acutPrintf (_T("\nDistance from base point to point %u is %f."), i, pointDistArray[i]);

was printing out correctly, including pointDistArray[43], thought pCoord's length was 44 and pointDistArray's length only 42. VC didn't complain during the built, Acad just crashed on arx unload, this confused me.

 

How is it possible?

Am I missing something obvious?

 

Regards,

DL

0 Likes