Loading cmds/dumpstate/DumpstateService.cpp +12 −8 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ #include "DumpstateService.h" #include <android-base/stringprintf.h> #include <memory> #include <android-base/stringprintf.h> #include "android/os/BnDumpstate.h" #include "DumpstateInternal.h" Loading Loading @@ -48,9 +49,10 @@ static binder::Status error(uint32_t code, const std::string& msg) { return binder::Status::fromServiceSpecificError(code, String8(msg.c_str())); } // Takes ownership of data. static void* callAndNotify(void* data) { DumpstateInfo& ds_info = *static_cast<DumpstateInfo*>(data); ds_info.ds->Run(ds_info.calling_uid, ds_info.calling_package); std::unique_ptr<DumpstateInfo> ds_info(static_cast<DumpstateInfo*>(data)); ds_info->ds->Run(ds_info->calling_uid, ds_info->calling_package); MYLOGD("Finished Run()\n"); return nullptr; } Loading Loading @@ -150,14 +152,16 @@ binder::Status DumpstateService::startBugreport(int32_t calling_uid, ds_->listener_ = listener; } DumpstateInfo ds_info; ds_info.ds = ds_; ds_info.calling_uid = calling_uid; ds_info.calling_package = calling_package; DumpstateInfo* ds_info = new DumpstateInfo(); ds_info->ds = ds_; ds_info->calling_uid = calling_uid; ds_info->calling_package = calling_package; pthread_t thread; status_t err = pthread_create(&thread, nullptr, callAndNotify, &ds_); status_t err = pthread_create(&thread, nullptr, callAndNotify, ds_info); if (err != 0) { delete ds_info; ds_info = nullptr; return error(err, "Could not create a background thread."); } return binder::Status::ok(); Loading Loading
cmds/dumpstate/DumpstateService.cpp +12 −8 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ #include "DumpstateService.h" #include <android-base/stringprintf.h> #include <memory> #include <android-base/stringprintf.h> #include "android/os/BnDumpstate.h" #include "DumpstateInternal.h" Loading Loading @@ -48,9 +49,10 @@ static binder::Status error(uint32_t code, const std::string& msg) { return binder::Status::fromServiceSpecificError(code, String8(msg.c_str())); } // Takes ownership of data. static void* callAndNotify(void* data) { DumpstateInfo& ds_info = *static_cast<DumpstateInfo*>(data); ds_info.ds->Run(ds_info.calling_uid, ds_info.calling_package); std::unique_ptr<DumpstateInfo> ds_info(static_cast<DumpstateInfo*>(data)); ds_info->ds->Run(ds_info->calling_uid, ds_info->calling_package); MYLOGD("Finished Run()\n"); return nullptr; } Loading Loading @@ -150,14 +152,16 @@ binder::Status DumpstateService::startBugreport(int32_t calling_uid, ds_->listener_ = listener; } DumpstateInfo ds_info; ds_info.ds = ds_; ds_info.calling_uid = calling_uid; ds_info.calling_package = calling_package; DumpstateInfo* ds_info = new DumpstateInfo(); ds_info->ds = ds_; ds_info->calling_uid = calling_uid; ds_info->calling_package = calling_package; pthread_t thread; status_t err = pthread_create(&thread, nullptr, callAndNotify, &ds_); status_t err = pthread_create(&thread, nullptr, callAndNotify, ds_info); if (err != 0) { delete ds_info; ds_info = nullptr; return error(err, "Could not create a background thread."); } return binder::Status::ok(); Loading