Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c60a5a58becc
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8247365808be
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 4, 2021

  1. Copy the full SHA
    f657a77 View commit details
  2. Copy the full SHA
    7ea5140 View commit details
  3. Merge pull request #3079 from pleroy/Forks

    Do not attempt to delete the prediction if it was already detached by the caller
    pleroy authored Aug 4, 2021
    Copy the full SHA
    8247365 View commit details
Showing with 5 additions and 2 deletions.
  1. +4 −1 ksp_plugin/vessel.cpp
  2. +1 −1 ksp_plugin/vessel.hpp
5 changes: 4 additions & 1 deletion ksp_plugin/vessel.cpp
Original file line number Diff line number Diff line change
@@ -227,6 +227,7 @@ void Vessel::AdvanceTime() {
// Squirrel away the prediction so that we can reattach it if we don't have a
// prognostication.
auto prediction = prediction_->DetachFork();
prediction_ = nullptr;

// Read the wall of text below and realize that this can happen for the
// history as well as the psychohistory, if the history of the part was
@@ -645,7 +646,9 @@ void Vessel::AttachPrediction(
if (trajectory->Empty()) {
prediction_ = psychohistory_->NewForkAtLast();
} else {
psychohistory_->DeleteFork(prediction_);
if (prediction_ != nullptr) {
psychohistory_->DeleteFork(prediction_);
}
prediction_ = trajectory.get();
psychohistory_->AttachFork(std::move(trajectory));
}
2 changes: 1 addition & 1 deletion ksp_plugin/vessel.hpp
Original file line number Diff line number Diff line change
@@ -227,7 +227,7 @@ class Vessel {
DiscreteTrajectory<Barycentric>& trajectory);

// Attaches the given |trajectory| to the end of the |psychohistory_| to
// become the new |prediction_|.
// become the new |prediction_|. If |prediction_| is not null, it is deleted.
void AttachPrediction(
not_null<std::unique_ptr<DiscreteTrajectory<Barycentric>>> trajectory);