-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Make sure that a Progress
"completed" update is always reported at destruction
#102097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: None (royitaqi) ChangesCurrently, a Changing it so that any See this discourse discussion for more details. Full diff: https://github.com/llvm/llvm-project/pull/102097.diff 1 Files Affected:
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 1a779e2ddf924..e0ba1a63c508e 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -45,8 +45,7 @@ Progress::~Progress() {
// Make sure to always report progress completed when this object is
// destructed so it indicates the progress dialog/activity should go away.
std::lock_guard<std::mutex> guard(m_mutex);
- if (!m_completed)
- m_completed = m_total;
+ m_completed = m_total;
ReportProgress();
// Report to the ProgressManager if that subsystem is enabled.
|
Was this why we saw some Swift progress dialogs hanging around forever? Looks ok to me. @JDevlieghere feel free to add any more reviewers that have been working on progress dialogs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Could we cover this scenario by the existing unit test?
Yes, definitely. At the time of the patch I didn't find any existing unit test files by searching for "ProgressTest.cpp". Just now I realize there is the ProgressReportTest.cpp. I will read it and try to add a test for this scenario. |
a2c9310
to
2858f0e
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
2858f0e
to
17538a4
Compare
@JDevlieghere A unit test has been added. I have confirmed that it fails before the patch, and succeeds after the patch. |
Progress
"completed" update is always reported at destructionProgress
"completed" update is always reported at destruction
Thanks @royitaqi! Once the formatting is fixed this is ready to be merged. |
…ted at destruction (llvm#102097) Make all `Progress` destructions to cause `progressEnd` events, regardless of the value of `m_completed` before the destruction. Currently, a `Progress` instance with `m_completed != 0 && m_complete != m_total` will cause a `progressUpdate` event (not `progressEnd`) at destruction and. This contradicts with the classdoc: "a progress completed update is reported even if the user doesn't explicitly cause one to be sent." (cherry picked from commit 12fa4b1)
…ted at destruction (llvm#102097) Make all `Progress` destructions to cause `progressEnd` events, regardless of the value of `m_completed` before the destruction. Currently, a `Progress` instance with `m_completed != 0 && m_complete != m_total` will cause a `progressUpdate` event (not `progressEnd`) at destruction and. This contradicts with the classdoc: "a progress completed update is reported even if the user doesn't explicitly cause one to be sent." (cherry picked from commit 12fa4b1)
Make all
Progress
destructions to causeprogressEnd
events, regardless of the value ofm_completed
before the destruction.Currently, a
Progress
instance withm_completed != 0 && m_complete != m_total
will cause aprogressUpdate
event (notprogressEnd
) at destruction (see Process.cpp and lldb-dap/ProgressEvent.cpp). This contradicts with the classdoc:See this discourse discussion for more details.
Test
Confirmed that the tests pass with the patch, and don't pass without the patch.