You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2020/02/11 09:12:48 UTC

[GitHub] [incubator-weex] ikantech opened a new issue #3135: [Android] 0.28.0 fireEventSync同步事件回调Java层无法收到

ikantech opened a new issue #3135: [Android] 0.28.0 fireEventSync同步事件回调Java层无法收到
URL: https://github.com/apache/incubator-weex/issues/3135
 
 
   经测试发现,nativeback等同步事件回调Java层无法收到,底层返回callbackid与Java层callbackid无法对应,所以无法触发回调。
   
   core_side_in_script.cpp :
   ```cpp
   void CoreSideInMultiProcess::OnReceivedResult(long callback_id,
                                                 std::unique_ptr<WeexJSResult> &result) {
     BackToWeexCoreQueue::IPCTask *ipc_task = new BackToWeexCoreQueue::IPCTask(
         IPCProxyMsg::ONRECEIVEDRESULT);
   
     auto temp = std::to_string(callback_id);
     ipc_task->addParams(temp.c_str(), temp.length());
     if (result != nullptr) {
       ipc_task->addParams(result->data.get(), result->length);
     }
     WeexEnv::getEnv()->m_back_to_weex_core_thread.get()->addTask(ipc_task);
   }
   ```
   这里传输的是字符串,而在返回WeexCore后,则直接转成了long
   
   script_bridge_in_multi_process.cpp: 
   ```cpp
   std::unique_ptr<IPCResult> OnReceivedResult(IPCArguments *arguments) {
     long callback_id = arguments->get<long>(0);
     std::unique_ptr<WeexJSResult> result;
   ```
   
   应该要由string转long
   
   ```cpp
   std::unique_ptr<IPCResult> OnReceivedResult(IPCArguments *arguments) {
     auto arg1 = std::unique_ptr<char[]>(getArumentAsCStr(arguments, 0));
     long callback_id = atol(arg1.get());
   ```
   
   由于我未深入了解weex底层,代码不一定正确,烦请官方修复,谢谢
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services