可以回调 - > InvokeAsync(“”,FB :: variant_list_of(shared_from_this())(result));抛出bad_weak_ptr异常?

时间:2014-10-10 09:03:19

标签: c++ boost firebreath

我想知道是回调 - > InvokeAsync(“”,FB :: variant_list_of(shared_from_this())(result));可以抛出bad_weak_ptr异常。根据{{​​3}}和firebreath文档,callbackJSObjectPtr,它定义了代表JSObject shared_ptr的别名,而shared_from_this()FB::JSAPI的方法将FB::JSAPIPtr返回给当前对象(也是shared_pointer)。 我在npapi插件中使用了以下代码:

void MyClassAPI::MyFunction(const std::string& arg1,
                            const std::string& arg2,
                            const FB::JSObjectPtr & callback) try {

                            //some code here

                            callback->InvokeAsync("", FB::variant_list_of(shared_from_this())(result));

                            }catch(...){

                            //some code here

                            callback->InvokeAsync("", FB::variant_list_of(shared_from_this())(result));

                            }

抛出一个:terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_weak_ptr> >' what(): tr1::bad_weak_ptr when I am in a browser's tab and close it before function finishes its execution.,我无法真正理解这个异常的来源。

0 个答案:

没有答案