Skip to content

Commit

Permalink
call shared_state::owner_destroyed() only if future was created from
Browse files Browse the repository at this point in the history
- in context of #167
- in dtor of promise_base and packaged_task test if shared-state was
  initialized and a future was constructed from shared_state
- call shared_state::owner_destroyed() only if both condition are true
  • Loading branch information
olk committed Jan 11, 2018
1 parent e325cf7 commit f12288b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/boost/fiber/future/packaged_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class packaged_task< R( Args ... ) > {
}

~packaged_task() {
if ( task_) {
if ( task_ && obtained_) {
task_->owner_destroyed();
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/boost/fiber/future/promise.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct promise_base {
}

~promise_base() {
if ( future_) {
if ( future_ && obtained_) {
future_->owner_destroyed();
}
}
Expand Down

0 comments on commit f12288b

Please sign in to comment.