diff --git a/src/source_diff.cc b/src/source_diff.cc index 5e397ac..b3507b2 100644 --- a/src/source_diff.cc +++ b/src/source_diff.cc @@ -178,6 +178,7 @@ void Source::DiffView::configure() { }); parse_thread=std::thread([this]() { + std::string status_branch; try { diff=get_diff(); status_branch=repository->get_branch(); @@ -185,7 +186,8 @@ void Source::DiffView::configure() { catch(const std::exception &) { status_branch=""; } - dispatcher.post([this] { + dispatcher.post([this, status_branch=std::move(status_branch)] { + this->status_branch=status_branch; if(update_status_branch) update_status_branch(this); }); @@ -216,8 +218,8 @@ void Source::DiffView::configure() { if(monitor_changed.compare_exchange_strong(expected_monitor_changed, false)) { try { diff=get_diff(); - status_branch=repository->get_branch(); - dispatcher.post([this] { + dispatcher.post([this, status_branch=repository->get_branch()] { + this->status_branch=status_branch; if(update_status_branch) update_status_branch(this); }); @@ -230,7 +232,7 @@ void Source::DiffView::configure() { get_buffer()->remove_tag(renderer->tag_removed_below, get_buffer()->begin(), get_buffer()->end()); get_buffer()->remove_tag(renderer->tag_removed_above, get_buffer()->begin(), get_buffer()->end()); renderer->queue_draw(); - status_branch=""; + this->status_branch=""; if(update_status_branch) update_status_branch(this); });