diff options
| author | Pavel Labath <labath@google.com> | 2015-07-17 10:08:38 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2015-07-17 10:08:38 +0000 |
| commit | f3898c30e6ce51183170e161a85e0c0964f1c5a9 (patch) | |
| tree | e2069c1f00e0ce168fa78387dcc6dd5cd4a73242 /lldb | |
| parent | 65bc306345848b3a79753a435a19a639da6942e2 (diff) | |
| download | bcm5719-llvm-f3898c30e6ce51183170e161a85e0c0964f1c5a9.tar.gz bcm5719-llvm-f3898c30e6ce51183170e161a85e0c0964f1c5a9.zip | |
[MainLoop] Fix assertion failure
Upon connection termination the waitable handle of an IOObject gets reset to an invalid handle.
This caused a problem since we used the object->GetWaitableHandle as a key to the set of
registered events. The fix is to use something more immutable as a key: we make a copy of the
original waitable handle, instead of holding onto the IOObject.
llvm-svn: 242515
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/include/lldb/Host/MainLoopBase.h | 12 | ||||
| -rw-r--r-- | lldb/include/lldb/Host/posix/MainLoopPosix.h | 2 | ||||
| -rw-r--r-- | lldb/source/Host/posix/MainLoopPosix.cpp | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lldb/include/lldb/Host/MainLoopBase.h b/lldb/include/lldb/Host/MainLoopBase.h index bff2ce78110..da14349cf82 100644 --- a/lldb/include/lldb/Host/MainLoopBase.h +++ b/lldb/include/lldb/Host/MainLoopBase.h @@ -60,25 +60,25 @@ public: protected: ReadHandleUP CreateReadHandle(const lldb::IOObjectSP &object_sp) - { return ReadHandleUP(new ReadHandle(*this, object_sp)); } + { return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle())); } virtual void - UnregisterReadObject(const lldb::IOObjectSP &object_sp) + UnregisterReadObject(IOObject::WaitableHandle handle) { llvm_unreachable("Not implemented"); } private: class ReadHandle { public: - ~ReadHandle() { m_mainloop.UnregisterReadObject(m_object_sp); } + ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); } private: - ReadHandle(MainLoopBase &mainloop, const lldb::IOObjectSP &object_sp) - : m_mainloop(mainloop), m_object_sp(object_sp) + ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle) + : m_mainloop(mainloop), m_handle(handle) { } MainLoopBase &m_mainloop; - lldb::IOObjectSP m_object_sp; + IOObject::WaitableHandle m_handle; friend class MainLoopBase; DISALLOW_COPY_AND_ASSIGN(ReadHandle); diff --git a/lldb/include/lldb/Host/posix/MainLoopPosix.h b/lldb/include/lldb/Host/posix/MainLoopPosix.h index 9a665ded295..225cebde4bc 100644 --- a/lldb/include/lldb/Host/posix/MainLoopPosix.h +++ b/lldb/include/lldb/Host/posix/MainLoopPosix.h @@ -60,7 +60,7 @@ public: protected: void - UnregisterReadObject(const lldb::IOObjectSP &object_sp) override; + UnregisterReadObject(IOObject::WaitableHandle handle) override; void UnregisterSignal(int signo); diff --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp index cb213b9b79f..dccd7fa8022 100644 --- a/lldb/source/Host/posix/MainLoopPosix.cpp +++ b/lldb/source/Host/posix/MainLoopPosix.cpp @@ -94,9 +94,9 @@ MainLoopPosix::RegisterSignal(int signo, const Callback &callback, Error &error) } void -MainLoopPosix::UnregisterReadObject(const lldb::IOObjectSP &object_sp) +MainLoopPosix::UnregisterReadObject(IOObject::WaitableHandle handle) { - bool erased = m_read_fds.erase(object_sp->GetWaitableHandle()); + bool erased = m_read_fds.erase(handle); (void) erased; assert(erased); } |

