我在调用回调时收到访问冲突错误:
typedef std::function<void(INT_PTR)> DIALOG_CALLBACK;
//Declaration
string userId=getUserId();
DIALOG_CALLBACK callTest=[userID, this] (INT_PTR) -> void{};//Does nothing yet
CustomDialog dlg=new CustomDialog("Are you sure you wish to run this operation", callTest);
....
//Definition
class CustomDialog: DialogBase{
public:
DIALOG_CALLBACK callback;
....
}
//Call
void CustomDialog::OnOK(){
callback(1);//Error occurs within call
}
崩溃发生在标准文件xxfunction
_Ret operator()(_ARG0_A0) const
{ // call through stored object
if (_Impl == 0)
_Xfunc();
return (_Impl->_Do_call(_A0_A1));//Crashes on this line
}
链接:
答案 0 :(得分:0)
看来我在某个时候删除了这个指针,这就是造成这个问题的原因。