2011-05-02 6 views
0

나는 액세스 위반 오류가 발생하고있다 :C++에서 lambda를 호출 할 때 액세스 위반이 있습니까? 내가 콜백을 호출 할 때

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

문제가 발생한 부분에서이 포인터를 삭제 한 것처럼 보입니다.

관련 문제