[Lldb-commits] [lldb] r222816 - Re-order the base classes to prevent a crash in Linux.

Hafiz Abid Qadeer hafiz_abid at mentor.com
Wed Nov 26 02:19:32 PST 2014


Author: abidh
Date: Wed Nov 26 04:19:32 2014
New Revision: 222816

URL: http://llvm.org/viewvc/llvm-project?rev=222816&view=rev
Log:
Re-order the base classes to prevent a crash in Linux.

In the initialization list of IOHandlerConfirm, *this is basically casting
IOHandlerConfirm to its base IOHandlerDelegate and passing it to constructor of
IOHandlerEditline which uses it and crashes as constructor of IOHandlerDelegate
is still not called. Re-ordering the base classes makes sure that constructor of
IOHandlerDelegate runs first.

It would be good to have a test case for this case too.


Modified:
    lldb/trunk/include/lldb/Core/IOHandler.h

Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=222816&r1=222815&r2=222816&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Wed Nov 26 04:19:32 2014
@@ -628,9 +628,11 @@ namespace lldb_private {
         bool m_interrupt_exits;
     };
     
+    // The order of base classes is important. Look at the constructor of IOHandlerConfirm
+    // to see how.
     class IOHandlerConfirm :
-        public IOHandlerEditline,
-        public IOHandlerDelegate
+        public IOHandlerDelegate,
+        public IOHandlerEditline
     {
     public:
         IOHandlerConfirm (Debugger &debugger,





More information about the lldb-commits mailing list