[Lldb-commits] [PATCH] D80447: [lldb] Fix a potential bug that may cause assert failure in CommandObject::CheckRequirements

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 27 05:22:20 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG18bb1f106702: [lldb] Fix a potential bug that may cause assert failure in CommandObject… (authored by teemperor).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80447/new/

https://reviews.llvm.org/D80447

Files:
  lldb/source/Interpreter/CommandObject.cpp


Index: lldb/source/Interpreter/CommandObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandObject.cpp
+++ lldb/source/Interpreter/CommandObject.cpp
@@ -18,6 +18,7 @@
 #include "lldb/Core/Address.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Utility/ArchSpec.h"
+#include "llvm/ADT/ScopeExit.h"
 
 // These are for the Sourcename completers.
 // FIXME: Make a separate file for the completers.
@@ -269,6 +270,7 @@
 void CommandObject::HandleCompletion(CompletionRequest &request) {
 
   m_exe_ctx = m_interpreter.GetExecutionContext();
+  auto reset_ctx = llvm::make_scope_exit([this]() { Cleanup(); });
 
   // Default implementation of WantsCompletion() is !WantsRawCommandString().
   // Subclasses who want raw command string but desire, for example, argument
@@ -296,8 +298,6 @@
     // If we got here, the last word is not an option or an option argument.
     HandleArgumentCompletion(request, opt_element_vector);
   }
-
-  m_exe_ctx.Clear();
 }
 
 bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80447.266496.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200527/4f5a5cd6/attachment.bin>


More information about the lldb-commits mailing list