Commit 146298f3 authored by Kenton Varda's avatar Kenton Varda

Must attach reference when calling whenMoreResolved().

parent 02be7235
...@@ -359,7 +359,8 @@ public: ...@@ -359,7 +359,8 @@ public:
// something outside the membrane later. We have to wait before we actually redirect, // something outside the membrane later. We have to wait before we actually redirect,
// otherwise behavior will differ depending on whether the promise is resolved. // otherwise behavior will differ depending on whether the promise is resolved.
KJ_IF_MAYBE(p, whenMoreResolved()) { KJ_IF_MAYBE(p, whenMoreResolved()) {
return newLocalPromiseClient(kj::mv(*p))->newCall(interfaceId, methodId, sizeHint); return newLocalPromiseClient(p->attach(addRef()))
->newCall(interfaceId, methodId, sizeHint);
} }
return ClientHook::from(kj::mv(*r))->newCall(interfaceId, methodId, sizeHint); return ClientHook::from(kj::mv(*r))->newCall(interfaceId, methodId, sizeHint);
...@@ -386,7 +387,8 @@ public: ...@@ -386,7 +387,8 @@ public:
// something outside the membrane later. We have to wait before we actually redirect, // something outside the membrane later. We have to wait before we actually redirect,
// otherwise behavior will differ depending on whether the promise is resolved. // otherwise behavior will differ depending on whether the promise is resolved.
KJ_IF_MAYBE(p, whenMoreResolved()) { KJ_IF_MAYBE(p, whenMoreResolved()) {
return newLocalPromiseClient(kj::mv(*p))->call(interfaceId, methodId, kj::mv(context)); return newLocalPromiseClient(p->attach(addRef()))
->call(interfaceId, methodId, kj::mv(context));
} }
return ClientHook::from(kj::mv(*r))->call(interfaceId, methodId, kj::mv(context)); return ClientHook::from(kj::mv(*r))->call(interfaceId, methodId, kj::mv(context));
......
...@@ -2394,7 +2394,7 @@ private: ...@@ -2394,7 +2394,7 @@ private:
kj::Own<ClientHook> resolvedCap) { kj::Own<ClientHook> resolvedCap) {
auto vpap = startCall(interfaceId, methodId, kj::mv(resolvedCap), kj::mv(context)); auto vpap = startCall(interfaceId, methodId, kj::mv(resolvedCap), kj::mv(context));
return kj::tuple(kj::mv(vpap.promise), kj::mv(vpap.pipeline)); return kj::tuple(kj::mv(vpap.promise), kj::mv(vpap.pipeline));
})).attach(addRef(*this)).split(); })).attach(addRef(*this), kj::mv(capability)).split();
return { return {
kj::mv(kj::get<0>(promises)), kj::mv(kj::get<0>(promises)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment