[Lldb-commits] [lldb] r137421 - /lldb/trunk/tools/driver/IOChannel.cpp

Jason Molenda jmolenda at apple.com
Thu Aug 11 19:40:17 PDT 2011

Author: jmolenda
Date: Thu Aug 11 21:40:17 2011
New Revision: 137421

URL: http://llvm.org/viewvc/llvm-project?rev=137421&view=rev
Fixes the occasional crash on exit when quitting lldb with control-D.

If the IOChannel has already freed out its m_driver member, and
there's still a character to be read/written (that is, the ^D
character), just skip that char instead of trying to write through
a null object pointer.


Modified: lldb/trunk/tools/driver/IOChannel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.cpp?rev=137421&r1=137420&r2=137421&view=diff
--- lldb/trunk/tools/driver/IOChannel.cpp (original)
+++ lldb/trunk/tools/driver/IOChannel.cpp Thu Aug 11 21:40:17 2011
@@ -503,6 +503,15 @@
     if (len == 0)
+    // We're in the process of exiting -- IOChannel::Run() has already completed
+    // and set m_driver to NULL - it is time for us to leave now.  We might not
+    // print the final ^D to stdout in this case.  We need to do some re-work on
+    // how the I/O streams are managed at some point.
+    if (m_driver == NULL)
+    {
+        return;
+    }
     // Use the mutex to make sure OutWrite and ErrWrite do not interfere with each other's output.
     IOLocker locker (m_output_mutex);
     if (m_driver->EditlineReaderIsTop() && asynchronous)

More information about the lldb-commits mailing list