the application has requested the runtime to terminate it in an unusual way qt c++ [closed]

asked 2014-03-08 10:07:48 -0600

zowpro gravatar image

updated 2014-03-12 05:40:40 -0600


What does it mean that you display this message "the application has requested the runtime to terminate it in an unusual way" after inserting a correct program in Qt creator C + +. image description Thanks


I did the translation of contour points (about 300-1000 poitns) ie each point I changed its X and Y coordinates to move the vector XOY center of gravity with this formula:

   contours_poly[0][i].x = contours_poly[0][i]..x-mc[1].x; 
   contours_poly[0][i].y = contours_poly[0][i]..y-mc[1].y; 
   contours_poly[1][i].x = contours_poly[1][i]x-mc[1].x; 
   contours_poly[1][i].y = contours_poly[1][i].y-mc[1].y; 
} // mc[1].x and mc[1].y are the coordinate of center of gravity

But I do not know if the bug is generated by the modification of a large number of points or what is the formula that is false. thank you

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by StevenPuttemans
close date 2014-03-14 02:18:09.020103



bad_alloc.. you ran out of memory ?

berak gravatar imageberak ( 2014-03-09 11:53:01 -0600 )edit

Probably you made an error in your code. Please give us some more information to get you the help needed ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-10 10:15:09 -0600 )edit

Please use the 'edit' button, it is there for a reason. Don't add other problems or explanations in an answer. Deleted and added it to the question myself.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-12 05:41:48 -0600 )edit

hi @zowpro, you confused the indices in the code above. it's : contours_poly[ contour_id ][ point_id ].

  • i goes over contours, but you use it as point index
  • you access contours_poly[0] and contours_poly[1] without checking, if there are (enough ) contours at all
  • you can't use 2 different contours in the same loop with the same indices, they will have different sizes
berak gravatar imageberak ( 2014-03-12 08:22:09 -0600 )edit

Thanks guys, i resolved my problem

zowpro gravatar imagezowpro ( 2014-03-12 10:42:57 -0600 )edit