File tree Expand file tree Collapse file tree
libs/server-sdk/src/data_systems/fdv2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,8 +137,12 @@ Conditions::Conditions(std::vector<std::unique_ptr<IFDv2Condition>> conditions)
137137 : conditions_(std::move(conditions)), state_(std::make_shared<State>()) {
138138 MakeAggregateFuture (conditions_)
139139 .Then (
140- [state =
141- state_](IFDv2Condition::Type const & type) -> std::monostate {
140+ [weak_state = std::weak_ptr<State>(state_)](
141+ IFDv2Condition::Type const & type) -> std::monostate {
142+ auto state = weak_state.lock ();
143+ if (!state) {
144+ return {};
145+ }
142146 std::vector<PendingEntry> drained;
143147 {
144148 std::lock_guard lock (state->mutex );
@@ -177,7 +181,11 @@ async::Future<IFDv2Condition::Type> Conditions::GetFuture(
177181 // callback fires synchronously inside the ctor and needs to acquire
178182 // state_->mutex.
179183 auto cb = std::make_unique<async::CancellationCallback>(
180- token, [state = state_, id]() {
184+ token, [weak_state = std::weak_ptr<State>(state_), id]() {
185+ auto state = weak_state.lock ();
186+ if (!state) {
187+ return ;
188+ }
181189 std::lock_guard lock (state->mutex );
182190 state->pending .erase (
183191 std::remove_if (
You can’t perform that action at this time.
0 commit comments