Я получаю ошибку нарушения доступа при вызове обратного вызова:
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
}
Ссылки: