c++ - unhandled exception Access violation writing location in Visual Studio -
is there way in visual studio 2005 find out pointer or variable causing access violation? tried run in debug mode , break when happens. looking @ call stacks, happens in end of function (see below). using try/catch able find out pointer is?
edit: posting code:
there qt line edit , checkbox in application. toggling checkbox switch data format in line edit. 3'b111 <==> 3'h7. below callback function connected checkbox statechanged signal. exception happens in end of function, when destructing local variables.
// switch hex/binary format. 15'h0000 <==> 15'b000000000000000 void switchdataformat(int checkstate) { qlineedit* writeregle = this->getwritereglineedit(); string oldtext = writeregle->text().tostdstring(); string newtext = ""; int maxlength; string reglengthtext = oldtext.substr(0, oldtext.find('\'')); string regvaluetext = oldtext.substr(oldtext.find('\'')+2); int reglength = this->getreglength(); if (checkstate == qt::unchecked) { // switch binary format maxlength = reglengthtext.size() + 2 + reglength; string binarytext; (int = 0; < regvaluetext.size(); ++i) { binarytext += hextobinary(regvaluetext[i]); } newtext = reglengthtext + "'b" + binarytext.substr(binarytext.size()-reglength); // trimming leading zeros fit reglength } else { // switch hex format maxlength = reglengthtext.size() + 2 + reglength/4 + 1; newtext = reglengthtext + "'h"; // 0 filling 4*n bits if (reglength%4 != 0) regvaluetext = string(reglength%4,'0') + regvaluetext; (int = 0; < regvaluetext.size(); i+=4) { newtext += binarytohex(regvaluetext.substr(i,4)); } } writeregle->setmaxlength(maxlength); writeregle->settext(qstring::fromutf8(newtext.c_str())); }
Comments
Post a Comment