Passthrough oneway: keep hold on mImpl

Test: hidl_test
Bug: 37675100
(cherry picked from commit a4c565f5fd0e3300fef360f5e94d275927eb17d1)
Merged-In: I86815cc95091c6f439dffff975dfe81d330d9340
Change-Id: I86815cc95091c6f439dffff975dfe81d330d9340
diff --git a/generateCpp.cpp b/generateCpp.cpp
index 44c785b..e12d140 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -690,7 +690,10 @@
     out << "auto _hidl_return = ";
 
     if (method->isOneway()) {
-        out << "addOnewayTask([this, &_hidl_error";
+        out << "addOnewayTask([mImpl = this->mImpl, "
+               "mEnableInstrumentation = this->mEnableInstrumentation, "
+               "mInstrumentationCallbacks = this->mInstrumentationCallbacks, "
+               "&_hidl_error";
         for (const auto &arg : method->args()) {
             out << ", "
                 << (arg->type().isInterface() ? "_hidl_wrapped_" : "")
@@ -698,7 +701,6 @@
         }
         out << "] {\n";
         out.indent();
-        out << "this->";
     }
 
     out << "mImpl->"