diff --git a/experiments/shell/clipboard_scenario_state.hpp b/experiments/shell/clipboard_scenario_state.hpp index c1fc2e20..daf6bc64 100644 --- a/experiments/shell/clipboard_scenario_state.hpp +++ b/experiments/shell/clipboard_scenario_state.hpp @@ -217,10 +217,14 @@ class ClipboardScenarioOwner { if(!error_) record_failure(step_.load(),GetLastError()); if(opened) { step("CloseClipboard-cleanup"); + SetLastError(0); if(!CloseClipboard()) record_failure("CloseClipboard-cleanup",GetLastError()); } if(window_ && IsWindow(window_)) { step("DestroyWindow-cleanup"); + // DestroyWindow does not reliably set the last error; clear it + // so a failure here cannot inherit the previous call's code. + SetLastError(0); if(!DestroyWindow(window_)) record_failure("DestroyWindow-cleanup",GetLastError()); } SetEvent(ready_.get()); SetEvent(released_.get());