Skip to content

Commit

Permalink
protobuf/echo/Echo: Fix function getting out of scope
Browse files Browse the repository at this point in the history
  • Loading branch information
richardapeters committed Nov 30, 2023
1 parent b8981b0 commit 8217500
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion protobuf/echo/Echo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ namespace services
if (readerAccess.Referenced())
readerAccess.SetAction([this]()
{
auto& self = *this;
ReaderDone();
DataReceived();
// ReaderDone() may result in readerAccess' completion callback being reset, which invalidates the saved this pointer
self.DataReceived();
});
else
ReaderDone();
Expand Down

0 comments on commit 8217500

Please sign in to comment.